mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Michael Kerrisk <michael.kerrisk@googlemail.com>,
	aaw <aaw@google.com>, Andrew Morton <akpm@linux-foundation.org>,
	michael.kerrisk@gmail.com, carlos@codesourcery.com,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	drepper@redhat.com, mtk.manpages@gmail.com
Subject: Re: [RFC/PATCH] RLIMIT_ARG_MAX
Date: Fri, 29 Feb 2008 10:12:26 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.1.00.0802290956110.17889@woody.linux-foundation.org> (raw)
In-Reply-To: <1204306934.6243.119.camel@lappy>



On Fri, 29 Feb 2008, Peter Zijlstra wrote:
> 
> > More importantly, isn't it better to just use the whole stack size then 
> 
> Well, we ran into trouble of freshly spawned tasks faulting on the first
> stack grow. The /4 thing was to avoid that situation.

Yeah, I do see the point of wanting slop, but maybe the right thing to do 
is simply to just not make the slop be 75% of it all ;)

The thing is, RLIMIT_STACK has never been "exact" in the first place (ie 
it has *always* contained the argument and environment as a part of it), 
and that is really traditional behaviour even outside of Linux.

And I seriously doubt that RLIMIT_ARG_MAX really buys people anything 
truly wonderful, and it definitely adds just another thing you can screw 
up and make the system just behave differently depending on a config value 
that doesn't even matter to the kernel. In fact, even with that patch, 
it's *still* not going to handle the difference between the actual string 
space and the pointers themselves, or even all the other setup stuff that 
the binary loaders will put on the stack.

So it's not *going* to be exact even with RLIMIT_ARG_MAX, because it's 
going to have all those other issues to contend with - on a 64-bit 
architecture, the argument _pointers_ are often within an order of 
magnitude of the argument strings themselves, and I don't think your patch 
counted them as part of the argument/environemnt size (I was too lazy to 
check the sources, but I'm pretty sure argv/env_start/end is just the 
string space, not the pointers).

So rather than introduce a new thing that is not going to be trustworthy 
anyway, I'd much rather just remove the limit entirely.

Also, it all boils down to the fact that the whole argument is utter crap:

> POSIX disallows sysconf() variables to change during the execution of a
> process, so even if it would ask the kernel for a value, we could not
> give a sane answer.

If the resource limits change, then it makes not a whit of a difference 
whether _SC_ARG_MAX changes or not, because it's not going to reflect 
reality. So you might as well just continue to give the value we've always 
given (128k? I don't remember). Because it's not going to be the "real" 
value *anyway*.

This whole argument seems pointless. Has anybody ever really cared? Why 
not just keep _SC_ARG_MAX at the old (small) limit, and then the fact that 
99% of all programs won't even care, and that they can actually use much 
larger limits in real life is just gravy.

A *good* implementation would generally just do the execve() with the 
maximal arguments, and only bother to see "oh, maybe I can split it up" if 
it returns ENOMEM or whatever it does. 

So I don't see the practical value here - _SC_ARG_MAX is not worth having 
another tweaking value for that people will just always get wrogn anyway 
because there is no right answer (except "I don't want my stack to grow 
too large" where it's just one of the relevant things)

			Linus

  reply	other threads:[~2008-02-29 18:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 13:37 Peter Zijlstra
2008-02-29 16:05 ` Linus Torvalds
2008-02-29 16:58   ` Michael Kerrisk
2008-02-29 17:12     ` Linus Torvalds
2008-02-29 17:18       ` Peter Zijlstra
2008-02-29 17:29         ` Linus Torvalds
2008-02-29 17:42           ` Peter Zijlstra
2008-02-29 18:12             ` Linus Torvalds [this message]
2008-02-29 19:01               ` Ollie Wild
2008-02-29 19:09                 ` Jakub Jelinek
2008-02-29 19:50                   ` Linus Torvalds
2008-02-29 20:03                     ` Ollie Wild
2008-03-04 20:07           ` Pavel Machek
2008-02-29 17:14     ` Peter Zijlstra
2008-02-29 17:35       ` Linus Torvalds
2008-02-29 17:55         ` Peter Zijlstra
2008-02-29 18:14           ` Linus Torvalds
2008-02-29 18:18           ` Michael Kerrisk
2008-02-29 18:39             ` Linus Torvalds
2008-02-29 19:49               ` Michael Kerrisk
2008-02-29 20:07                 ` Linus Torvalds
2008-02-29 20:43                   ` Michael Kerrisk
2008-02-29 21:34                     ` Linus Torvalds
2008-02-29 21:57                   ` Linus Torvalds
2008-03-01 14:21                     ` Carlos O'Donell
2008-03-01  8:42             ` Geoff Clare
2008-02-29 18:40           ` Alan Cox

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=alpine.LFD.1.00.0802290956110.17889@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=carlos@codesourcery.com \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.kerrisk@gmail.com \
    --cc=michael.kerrisk@googlemail.com \
    --cc=mtk.manpages@gmail.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

all inboxes | Powered by JetHome®