public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Zorro Lang <zlang@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/084: check inotify limit before tail many files
Date: Fri, 14 Aug 2015 14:58:07 +0800	[thread overview]
Message-ID: <20150814065807.GL17933@dhcp-13-216.nay.redhat.com> (raw)
In-Reply-To: <1439482592-29611-1-git-send-email-zlang@redhat.com>

On Fri, Aug 14, 2015 at 12:16:32AM +0800, Zorro Lang wrote:
> generic/084 try to run 'tail' command, tail will use
> inotify, and there're some limit about inotify. I think
> the most important is fs.inotify.max_user_instances, then
> fs.inotify.max_user_watches is importand too.

max_user_watches is much larger (usually 8k?) than max_user_instances
(128), I think we can skip the max_user_watches check here.

> 
> When I test on a machine with 154 cpu cores, this case
> run failed, and hit many warning likes:
> 
>     tail: inotify cannot be used, reverting to polling: Too many
>     open files

No need to wrap lines for quoted logs.

> 
> Because the fs.inotify.max_user_instances is 128, so if
> we try to tail 154 files, it will be failed.
> 
> Of course, open files limit will effect this too. But generally
> max_user_instances is the minimum number, so I don't check open
> file limit.
> 
> Signed-off-by: Zorro Lang <zlang@redhat.com>
> ---
>  tests/generic/084 | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/generic/084 b/tests/generic/084
> index 3fec6c2..f34d4b2 100755
> --- a/tests/generic/084
> +++ b/tests/generic/084
> @@ -63,6 +63,15 @@ link_unlink_storm()
>  
>  rm -f $seqres.full
>  nr_cpu=`$here/src/feature -o`
> +user_watches=`sysctl -n fs.inotify.max_user_watches`
> +user_instances=`sysctl -n fs.inotify.max_user_instances`

I think we need some comments in the code too.

> +
> +user_limit=$((user_watches > user_instances ? user_instances : user_watches))

Please use plain if:then

> +if [ $nr_cpu -ge $((user_limit/2)) ]
> +then

if []; then
fi

this is the preferred format in xfstests

> +	nr_cpu=$((user_limit/2))

Need comments to explain why divide by 2.

Thanks,
Eryu
> +fi
> +
>  echo "Silence is golden"
>  
>  _scratch_mkfs >>$seqres.full 2>&1
> -- 
> 1.9.3
> 

  reply	other threads:[~2015-08-14  6:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 16:16 [PATCH] generic/084: check inotify limit before tail many files Zorro Lang
2015-08-14  6:58 ` Eryu Guan [this message]
2015-08-17  0:03 ` Dave Chinner
2015-08-17  1:05   ` Zirong Lang
2015-08-17  5:06     ` Dave Chinner
2015-08-17 13:55       ` Zirong Lang

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=20150814065807.GL17933@dhcp-13-216.nay.redhat.com \
    --to=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.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