lkml.org 
[lkml]   [2009]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC][PATCH 0/9] File descriptor hot-unplug support
Tejun Heo <tj@kernel.org> writes:

> Eric W. Biederman wrote:
>> Do you know of a case where we actually have multiple tasks accessing
>> a file simultaneously?
>
> I don't have anything at hand but multithread/process server accepting
> on the same socket comes to mind. I don't think it would be a very
> rare thing. If you confine the scope to character devices or sysfs,
> it could be quite rare tho.

Yes. I think I can safely exclude sockets, and not bother with
reference counting them.

The only strong evidence I have that multi-threading on a single file
descriptor is likely to be common is that we have pread and pwrite
syscalls. At the same time the number of races we have in struct file
if it is accessed by multiple threads at the same time, suggests
that at least for cases where you have an offset it doesn't happen often.

I cringe when I see per cpu counters for something like files that we
are likely to have a lot of. I keep imagining a quadratic explosion
in data size. In practice we are likely to have a small cpu count <=
8-16 cpus so it is likely ok. Especially if we are only allocating 8
bytes per cpu per file. I guess in total that is at most 128K per file.
8bytes*16k cpus. With the default system file-max on my systems 203871
to 705863, it looks like we would max out at between 1M and 5M per cpu.
Still a lot but survivable.

Somewhere it all falls down, but only if you max out a very rare
very large machine, and that seems to be case with just about everything.

Which all leads me to say that if we can avoid per cpu memory and not impact
performance I want to do that.

Eric


\
 
 \ /
  Last update: 2009-04-14 10:31    [W:0.093 / U:1.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site