Re: [BENCHMARK] nproc: netlink access to /proc information

William Lee Irwin III
2004-08-29T20:26:10Z

On Sun, 29 Aug 2004 12:17:07 -0700, William Lee Irwin III wrote:
>> Introducing another whole-tasklist scan, even if feasible, is probably
>> not a good idea.

On Sun, Aug 29, 2004 at 09:49:26PM +0200, Roger Luethi wrote:
> I'm not sure whether I should participate in that discussion. I'll risk
> discrediting nproc with wild speculations on a subject I haven't really
> looked into yet. Ah well...

There isn't much to speculate about here; reducing the arrival rate to
tasklist_lock is okay, but it can't be held forever or use unbounded
allocations or anything like that.

On Sun, Aug 29, 2004 at 09:49:26PM +0200, Roger Luethi wrote:
> As far as nproc (and process monitoring) is concerned, we aren't really
> interested in walking a complete process list. All we care about is
> which pids exist right now. How about a bit field, maintained by the
> kernel, to indicate for each pid whether it exists or not? This would
> amount to 4 KiB by default and 512 KiB for PID_MAX_LIMIT (4 million
> processes). Maintenance cost would be one atomic bit operation per
> process creation/deletion. No contested locks.
> The list for the nproc user could be prepared based on the bit field
> (or simply memcpy'd), no tasklist_lock or walking linked lists required.
> What am I missing?

The pid bitmap could be exported to userspace rather easily.

-- wli