lkml.org 
[lkml]   [2002]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] get_pid() performance fix
Date
On Friday 15 March 2002 10:16 am, OGAWA Hirofumi wrote:
> Whoops! I'm sorry. previous email was the middle of writing.
>
> Hubertus Franke <frankeh@watson.ibm.com> writes:
> > + if (i == PID_MAP_SIZE) {
> > + if (again) {
> > + /* we didn't find any pid , sweep and try again */
> > + again = 0;
> > + memset(pid_map, 0, PID_MAP_SIZE * sizeof(unsigned long));
> > + last_pid = RESERVED_PIDS;
> > + goto repeat;
> > + }
> > + next_safe = RESERVED_PIDS;
> > + return 0;
>
> Probably, the bug is here. No bug ....

>
> + next_safe = RESERVED_PIDS; /* or 0 */
>
> > + read_unlock(&tasklist_lock);
> > + spin_unlock(&lastpid_lock);
> > + return 0;
> > }
>
> Basically nice, I think.
>
> BTW, How about using the __set_bit(), find_next_zero_bit(), and
> find_next_bit() in get_pid_by_map().
>
> Thanks for nice work.

OGAWA, honestly I only tried testcase 2.
But looking at your suggestion its not clear to me whether
there is a bug.
Remember we need to determine a valid interval [ last_pid .. next_safe ).
In the pid_map function, if no pid is available, then
[ PID_MAX .. PID_MAX ) will be returned.
The other path should also end up with this as well.
Could you point where you see this not happening.

In the next release, I'll look at using your bitmap function suggestion.

--
-- Hubertus Franke (frankeh@watson.ibm.com)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.081 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site