Could ARG_MAX be increased?
David G. Lawrence
dg at dglawrence.com
Thu Sep 23 06:21:55 PDT 2004
> Currently, ARG_MAX is set to:
> $ getconf ARG_MAX
> 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.
David G. Lawrence
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.
More information about the freebsd-current