From: Hubertus Franke <frankeh@watson.ibm.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: "Rajan Ravindran" <rajancr@us.ibm.com>,
linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net
Subject: Re: [PATCH] get_pid() performance fix
Date: Mon, 18 Mar 2002 16:44:58 -0500 [thread overview]
Message-ID: <20020318214402.10A833FE06@smtp.linux.ibm.com> (raw)
In-Reply-To: <OF810580E6.8672B341-ON85256B73.005AF9B8@pok.ibm.com> <20020315183610.212993FE06@smtp.linux.ibm.com> <87zo19jdu7.fsf@devron.myhome.or.jp>
On Saturday 16 March 2002 12:12 am, OGAWA Hirofumi wrote:
> Hubertus Franke <frankeh@watson.ibm.com> writes:
> > 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.
>
> Maybe my point was unclear. Sorry.
>
> Please consider what happens after using up pid. Then,
> get_pid_by_map() returns 0.
>
> And last_pid = 0, next_safe = RESERVED_PIDS. After it, get_pid()
> returns the values between 0 and RESERVED_PIDS.
>
> And the line which I added is also the same reason.
>
> Regards.
Hirofumi, yes you are right, "the thought was there, but the implementation
was weak".
Proofs again, all these benchmarks are not enough. I'll make a new patch
soon and resubmit.
--
-- Hubertus Franke (frankeh@watson.ibm.com)
next prev parent reply other threads:[~2002-03-18 21:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-05 16:43 Fwd: [Lse-tech] get_pid() performance fix Rajan Ravindran
2002-03-05 17:57 ` OGAWA Hirofumi
2002-03-05 19:53 ` Hubertus Franke
2002-03-05 20:10 ` OGAWA Hirofumi
2002-03-05 21:59 ` Hubertus Franke
2002-03-05 22:48 ` OGAWA Hirofumi
2002-03-05 23:40 ` Hubertus Franke
2002-03-14 23:18 ` [PATCH] " Hubertus Franke
2002-03-15 14:57 ` OGAWA Hirofumi
2002-03-15 15:16 ` OGAWA Hirofumi
2002-03-15 18:37 ` Hubertus Franke
2002-03-16 5:12 ` OGAWA Hirofumi
2002-03-18 21:44 ` Hubertus Franke [this message]
2002-03-22 22:14 ` Hubertus Franke
2002-03-22 22:28 ` Davide Libenzi
2002-03-22 22:26 ` Hubertus Franke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020318214402.10A833FE06@smtp.linux.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=rajancr@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).