All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <Ian.Jackson@eu.citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v3] tools/xenconsoled: Increase file descriptor limit
Date: Tue, 24 Feb 2015 17:37:04 +0000	[thread overview]
Message-ID: <21740.46784.612052.448676@mariner.uk.xensource.com> (raw)
In-Reply-To: <54E623B7.6070004@citrix.com>

Andrew Cooper writes ("Re: [PATCH v3] tools/xenconsoled: Increase file descriptor limit"):
> On 19/02/15 16:30, Ian Jackson wrote:
> > Why is this only a stopgap solution ?
> 
> It is yet another place with an arbitrary limit, which is one more
> moving part to go wrong.

OIC.  I meant `unlimited', but...

> >>> As Xenconsoled genuinely needs a large number of file descriptors
> >>> if a large number of domains are running, and is well behaved with
> >>> its descriptors, attempt to up the limit to the system maximum.
> > Perhaps you mean it should be "unlimited" but that doesn't seem right
> > either.
> 
> Where do I perhaps mean "unlimited"?
> 
> Attempting to set NOFILE with RLIM_INFINITY is an unconditional failure,
> and there is unfortunately no RLIM_SYSTEM_MAX.

Urgh.

I think this is a bug in Linux.

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html

  [EPERM]
      The limit specified to setrlimit() would have raised the maximum
      limit value, and the calling process does not have appropriate
      privileges.

But that's not what's happening, or at least, it's a contorted
interpretation.

Best in shell is using `sysctl':
   ulimit -H -n "$(sysctl -n fs.nr_open)"
But not very portable.

So I am now convinced this should be done in C :-/.

> > The value should be some multiple of the maximum number of
> > domains.
> 
> The maximum number of domains (limited by the domid abi) is 32751
...
> That would put the number of fds needed at 131004 + overhead (20
> perhaps?).  This is substantially larger than the default on Linux, but
> within the default system max of 2^20.

Considering this, and looking at your actual code I think you should
simply set the value to 131004[1] (plus say 1000 spare for libc use
and so on) and not bother with trying to find the system maximum.

It would be nice to warn if the attempt fails.

[1] Computed from appropriate #defines.

Ian.

  parent reply	other threads:[~2015-02-24 17:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 16:21 [PATCH v2] tools/xenconsoled: Increase file descriptor limit Andrew Cooper
2015-02-17 16:28 ` Wei Liu
2015-02-17 16:37   ` Andrew Cooper
2015-02-17 16:48     ` Wei Liu
2015-02-17 17:31       ` Andrew Cooper
2015-02-17 17:58         ` Wei Liu
2015-02-17 17:55       ` [PATCH v3] " Andrew Cooper
2015-02-17 22:41         ` Don Slutz
2015-02-19 11:04         ` Wei Liu
2015-02-19 16:30           ` Ian Jackson
2015-02-19 17:56             ` Andrew Cooper
2015-02-19 19:04               ` David Vrabel
2015-02-24 11:50               ` Andrew Cooper
2015-02-24 17:37               ` Ian Jackson [this message]
2015-02-19 16:25         ` Ian Campbell

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=21740.46784.612052.448676@mariner.uk.xensource.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.