[Samba] more smbd CPU mystery

Cochran, Wayne Owen wcochran at vancouver.wsu.edu
Fri Oct 24 22:46:04 GMT 2008


Well I have determined that everytime someone logs in/logs out
of a windows box in our lab *ALL* of the files in "My Directory"
are copied from/to the file server to the local client. Needless to
say this is retarded and needs to stop. The local sys admin needs
to perform some windows voodoo to redirect this directory.

Still this brings the mystery as to why smbd would take up so
much CPU. The work should mainly network and disk i/o bound
(not CPU bound).  nfsd doesn't have this kind of bad CPU performance,
why does smbd?

I had one of the users download a big file (which was being saved
on the desktop). During this I was running top on the file server
and noted it was continually soaking up 25% of the CPU:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND      
12270 liffland  20   0 12748 4776 3628 S   24  0.1   1:02.36 smbd             

Why would disk/network traffic be so CPU heavy? Shouldn't this mostly
be handled by a DMA controller?  Can anyone explain this.

I was running strace -- here is a small sample:

rocess 12270 attached - interrupt to quit
select(32, [5 21 31], [], NULL, {59, 890000}) = 1 (in [5], left {59, 330000})
read(5, "\0\0\0H", 4)                   = 4
read(5, "\377SMB2\0\0\0\0\30\7\310\0\0\0\0\0\0\0\0\0\0\0\0\4\0,"..., 72) = 72
fstat64(34, {st_mode=S_IFREG|0744, st_size=65112414, ...}) = 0
fcntl64(13, F_SETLKW64, {type=F_RDLCK, whence=SEEK_SET, start=24480, len=1}, 0xbff627c4) = 0
fcntl64(13, F_SETLKW64, {type=F_UNLCK, whence=SEEK_SET, start=24480, len=1}, 0xbff627e4) = 0
write(5, "\0\0\0T\377SMB2\0\0\0\0\210A\310\0\0\0\0\0\0\0\0\0\0\0"..., 88) = 88
gettimeofday({1224887351, 92207}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
read(5, "\0\0\200@", 4)                 = 4
read(5, "\377SMB/\0\0\0\0\30\7\310\0\0\0\0\0\0\0\0\0\0\0\0\4\0\377"..., 32832) = 32832
pwrite64(34, "V\307=\215\22\243\246\315\367\245Yw\303\31\305\6nLz\243"..., 32768, 65112414) = 32768
write(5, "\0\0\0/\377SMB/\0\0\0\0\210\1\310\0\0\0\0\0\0\0\0\0\0\0"..., 51) = 51
gettimeofday({1224887351, 100692}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 2 (in [5 31], left {60, 0})
ioctl(31, FIONREAD, [64])               = 0
read(31, "\1\0\0\0\2\0\0\0\0\0\0\0000\0\0\0ubuntu-8.04.1-de"..., 64) = 64
write(5, "\0\0\0G\377SMB\240\0\0\0\0\210\1\310\0\0\0\0\0\0\0\0\0"..., 75) = 75
gettimeofday({1224887351, 103900}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
read(5, "\0\0\0H", 4)                   = 4
read(5, "\377SMB2\0\0\0\0\30\7\310\0\0\0\0\0\0\0\0\0\0\0\0\4\0,"..., 72) = 72
fstat64(34, {st_mode=S_IFREG|0744, st_size=65145182, ...}) = 0
fcntl64(13, F_SETLKW64, {type=F_RDLCK, whence=SEEK_SET, start=24480, len=1}, 0xbff627c4) = 0
fcntl64(13, F_SETLKW64, {type=F_UNLCK, whence=SEEK_SET, start=24480, len=1}, 0xbff627e4) = 0
write(5, "\0\0\0T\377SMB2\0\0\0\0\210A\310\0\0\0\0\0\0\0\0\0\0\0"..., 88) = 88
gettimeofday({1224887351, 114838}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
read(5, "\0\0\0T", 4)                   = 4
read(5, "\377SMB\240\0\0\0\0\30\7\310\0\0\0\0\0\0\0\0\0\0\0\0\4"..., 84) = 84
gettimeofday({1224887351, 119138}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
read(5, "\0\0\200@", 4)                 = 4
read(5, "\377SMB/\0\0\0\0\30\7\310\0\0\0\0\0\0\0\0\0\0\0\0\4\0\377"..., 32832) = 32832
pwrite64(34, "B\225\371\317\243y\32\216\223\16:\33\n\32\5P!i\230\231"..., 32768, 65145182) = 32768
write(5, "\0\0\0/\377SMB/\0\0\0\0\210\1\310\0\0\0\0\0\0\0\0\0\0\0"..., 51) = 51
gettimeofday({1224887351, 126091}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [31], left {60, 0})
ioctl(31, FIONREAD, [64])               = 0
read(31, "\1\0\0\0\2\0\0\0\0\0\0\0000\0\0\0ubuntu-8.04.1-de"..., 64) = 64
write(5, "\0\0\0G\377SMB\240\0\0\0\0\210\1\310\0\0\0\0\0\0\0\0\0"..., 75) = 75
gettimeofday({1224887351, 128913}, NULL) = 0
select(32, [5 21 31], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})

I don't know if that is helpful.


Wayne O. Cochran
Assistant Professor Computer Science
wcochran at vancouver.wsu.edu



More information about the samba mailing list