lkml.org 
[lkml]   [2009]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    Subjectseeing strange values for tcp sk_rmem_alloc

    I'm hoping someone might be able to explain some odd behaviour that I'm
    seeing.

    Some of our developers wanted to be able to see how much of their rx
    socket buffer space was in use, so I added the following to sock_ioctl()


    case SIOCGSKRMEMALLOC:
    {
    int tmp;
    err = -EINVAL;
    if(!sock->sk)
    break;
    tmp = atomic_read(&sock->sk->sk_rmem_alloc);
    err = copy_to_user(argp, &tmp, sizeof(tmp));
    break;
    }

    To validate it, I wrote a testcase that opened a tcp socket, then looped
    sending 2k of data at a time to it and calling the above ioctl to check
    the sk_rmem_alloc value (without ever reading from the socket).

    The results were odd--I've copied them below. Can anyone explain how I
    can send 20K of data but sk_rmem_alloc still only shows 4.8K used, then
    it suddenly jumps by a lot on the next packet to something that more
    reflects reality, then repeats that pattern again? Is there some
    additional buffering happening somewhere in the TCP stack?

    Thanks,

    Chris

    used: 2424
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 4848
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 23696
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 42544
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 61392
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240
    used: 80240




    \
     
     \ /
      Last update: 2009-12-01 17:21    [W:0.021 / U:93.604 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site