Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 2004 05:26:20 -0700
From:      "David G. Lawrence" <dg@dglawrence.com>
To:        Juha Saarinen <juhasaarinen@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Could ARG_MAX be increased?
Message-ID:  <20040923122620.GW16205@nexus.dglawrence.com>
In-Reply-To: <b34be84204092304456066b0a0@mail.gmail.com>
References:  <b34be84204092304456066b0a0@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Currently, ARG_MAX is set to:
> 
> $ getconf ARG_MAX
> 65536
>  
> in syslimits.h. This is quite low compared to other OS (SunOS has 1MB
> IIRC, and OpenBSD 3.5 256K) and causes the "argument list too long"
> issues when for instance grep'ing in directories with lots of files.
> 
> Last time the limit was upped was ten years ago:
> 
> "Revision 1.4 / (download) - annotate - [select for diffs], Mon Aug 8
> 09:12:43 1994 UTC (10 years, 1 month ago) by davidg
> Branch: MAIN
> Changes since 1.3: +2 -2 lines
> Diff to previous 1.3 (colored)
> 
> Increased ARG_MAX even further...to 64k bytes."
> 
> Is there a reason for keeping ARG_MAX so low, or could it be increased
> to eg. 262,144 bytes?

   I feel compelled to respond since you mentioned me above and since I
wrote most of the code involved... :-)
   The main issue with increasing the size of ARG_MAX is that it will result
in more kernel virtual memory being reserved for temporary storage of the
args. This used to be a much larger problem when KVM was scarce, but less
of a problem now with 1GB or more of KVM. The args temporary space is
allocated out of exec_map (a submap of kernel_map), which is sized to be
about 16 * ARG_MAX. The '16' is to allow up to 16 processes to simultaneously
exec until additional execs are blocked waiting for KVM to become
available. Anyway, increasing ARG_MAX to 256K (roughly 4MB of KVM) should
be okay on most systems.

-DG

David G. Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175
The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040923122620.GW16205>