Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 5 Mar 2002 15:11:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 5 Mar 2002 15:11:21 -0500 Received: from mail.parknet.co.jp ([210.134.213.6]:53511 "EHLO mail.parknet.co.jp") by vger.kernel.org with ESMTP id ; Tue, 5 Mar 2002 15:11:10 -0500 To: frankeh@watson.ibm.com Cc: "Rajan Ravindran" , linux-kernel@vger.kernel.org, lse-tech@lists.sourceforge.net Subject: Re: Fwd: [Lse-tech] get_pid() performance fix In-Reply-To: <873czeaodr.fsf@devron.myhome.or.jp> <20020305195211.144FC3FE0C@smtp.linux.ibm.com> From: OGAWA Hirofumi Date: Wed, 06 Mar 2002 05:10:46 +0900 In-Reply-To: <20020305195211.144FC3FE0C@smtp.linux.ibm.com> Message-ID: <87g03e3hdl.fsf@devron.myhome.or.jp> Lines: 43 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hubertus Franke writes: > > I said: > > task { pid = 300, pgrp = 301, }; > > 301 is free; > > > > get_pid() returns 301. > > > > "task 301" can't call setsid(). pid 301 is available? > > The original code is/was: > > if(p->pid == last_pid || > p->pgrp == last_pid || > p->tgid == last_pid || > p->session == last_pid) { > if(++last_pid >= next_safe) { > if(last_pid & 0xffff8000) > last_pid = 300; > next_safe = PID_MAX; > } > goto repeat; > } > > if any process holds the pgrp=301 as in your case, 301 won't be eligible due > to (p->pgrp == last_pid) check. I know. > @@ -153,13 +155,18 @@ > if(last_pid & 0xffff8000) > last_pid = 300; > next_safe = PID_MAX; > + goto repeat; > } > - goto repeat; > + if(unlikely(last_pid == beginpid)) > + goto nomorepids; > + continue; You changed it. No? -- OGAWA Hirofumi - 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/