On Sat, Feb 18, 2006 at 01:04:14AM -0800, Andrew Morton wrote:
> Dipankar Sarma <[email protected]> wrote:
> Fair enough.
>
> What do you think of these changes?
>
>
> - Nuke the blank line between "}" and EXPORT_SYMBOL(). That's never seemed
> pointful to me.
Sounds good.
>
> - Make the get_max_files export use _GPL - only unix.ko uses it.
Always good. I just didn't want to be the one :)
> - Use `-1' in the arg to percpu_counter_mod() rather than `-1L'. The
> compiler will dtrt and we shouldn't be peering inside percpu_counter
> internals here anyway.
>
> - Scrub that - use percpu_counter_dec() and percpu_counter_inc().
Gah! I missed those APIs. Makes perfect sense.
>
> - percpu_counters can be inaccurate on big SMP. Before we actually fail a
> get_empty_filp() attempt, use the (new in -mm) expensive
> percpu_counter_sum() to check whether we're really over the limit.
> - if (get_nr_files() >= files_stat.max_files &&
> - !capable(CAP_SYS_ADMIN))
> - goto over;
> + if (get_nr_files() >= files_stat.max_files && !capable(CAP_SYS_ADMIN)) {
> + /*
> + * percpu_counters are inaccurate. Do an expensive check before
> + * we go and fail.
> + */
> + if (percpu_counter_sum(&nr_files) >= files_stat.max_files)
> + goto over;
> + }
Slight optimization -
if (get_nr_files() >= files_stat.max_files) {
if (capable(CAP_SYS_ADMIN)) {
/*
* percpu_counters are inaccurate. Do an expensive check before
* we go and fail.
*/
if (percpu_counter_sum(&nr_files) >=
files_stat.max_files)
goto over;
} else
goto over;
}
>
>
> - Make get_nr_files() static. Which is just as well - any callers might
> want the percpu_counter_sum() treatment. In which case we'd be better off
> exporting some
>
> bool are_files_over_limit(how_many_i_want);
Well, as of now there is none (xfs use was removed a few months ago).
So, I removed the EXPORT_SYMBOL for get_nr_files() and forgot to
make it static. Your patch does the right thing.
Thanks
Dipankar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]