public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: steve <lingxiang@huawei.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "zhangtiger@huawei.com" <zhangtiger@huawei.com>,
	"lingxiang@huawei.com" <lingxiang@huawei.com>
Subject: why nfs server delay 10ms in nfsd_write()?
Date: Thu, 19 May 2005 10:46:53 +0800	[thread overview]
Message-ID: <0IGP00IZRULADZ@szxml02-in.huawei.com> (raw)

Hi all,
when i build nfs server with linux 2.6.9, i found nfs write performance is very low, and with 
tcpdump, i found the time to process write is very long, please refer as follows:

14:59:22.844977 IP  192.168.0.1.3376789825 >  linux.site.nfs: 660 write [|nfs]
14:59:22.855134 IP  linux.site.nfs >  192.168.0.1.3376789825: reply ok 136 write POST: [|nfs]

the write operation cost nearly 10ms, so i look up the source code and find the following code 
in nfsd_write():

{
..
if (atomic_read(&inode-> i_writecount) >  1
    || (last_ino == inode-> i_ino && last_dev == inode-> i_sb-> s_dev)) {
dprintk("nfsd: write defer %d\n", current-> pid);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((HZ+99)/100);
dprintk("nfsd: write resume %d\n", current-> pid);
}
..
}

so it will sleep for 10ms if the condition matches.

i have 2 questions:
1.i don't know why do we have to sleep for 10 ms, why not do sync immediately?
2.what will happen if we don't sleep for 10ms?
when i delete these codes, i get a good result, and the write performace improved from 300KB/s to 18MB/s

Regards!  
Steve
2005-05-19



             reply	other threads:[~2005-05-19  2:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-19  2:46 steve [this message]
2005-05-19  3:08 ` why nfs server delay 10ms in nfsd_write()? Trond Myklebust
2005-05-19  3:13 ` Lee Revell
2005-05-19 12:53   ` Peter Staubach
2005-05-19 13:26     ` Trond Myklebust
2005-05-19 13:41       ` Peter Staubach
2005-05-19 13:59     ` Lee Revell
2005-05-19 14:10       ` Peter Staubach
2005-05-19 14:13       ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2005-05-20 10:44 steve
2005-05-20 13:05 ` Peter Staubach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0IGP00IZRULADZ@szxml02-in.huawei.com \
    --to=lingxiang@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhangtiger@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox