public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Ingo Molnar <mingo@elte.hu>, Dave Jones <davej@suse.de>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: Re: [patch] scheduler bits from 2.5.23-dj1
Date: Thu, 20 Jun 2002 12:26:33 -0700	[thread overview]
Message-ID: <20020620192633.GZ22961@holomorphy.com> (raw)
In-Reply-To: <20020620181729.GY22961@holomorphy.com>

On Thu, Jun 20, 2002 at 07:31:18PM +0200, Ingo Molnar wrote:
>> looks good to me - what do you think about my other pidhash suggestion:

On Thu, Jun 20, 2002 at 11:17:29AM -0700, William Lee Irwin III wrote:
> An excellent idea. I didn't go all the way and make the pidhash entirely
> private to fork.c but taking find_task_by_pid() out-of-line is implemented
> in the following, built atop the prior patch. I can also privatize the
> pidhash entirely if that's wanted.

The final piece, built on top of the previous two. Please comment and/or
use your discretion. Although I test compiled and booted it on UP i386,
this may not be the desired cleanup. The original purpose of this was to
enforce the usage of Linux' standard list data type for the pidhash.


Cheers,
Bill


diff -urN linux-2.5.23-virgin/include/linux/sched.h linux-2.5.23-wli/include/linux/sched.h
--- linux-2.5.23-virgin/include/linux/sched.h	Thu Jun 20 11:39:08 2002
+++ linux-2.5.23-wli/include/linux/sched.h	Thu Jun 20 11:41:26 2002
@@ -441,24 +441,8 @@
 extern struct task_struct *init_tasks[NR_CPUS];
 
 /* PID hashing. */
-extern list_t *pidhash;
-extern unsigned long pidhash_size;
-
-static inline unsigned pid_hashfn(pid_t pid)
-{
-	return ((pid >> 8) ^ pid) & (pidhash_size - 1);
-}
-
-static inline void hash_pid(struct task_struct *p)
-{
-	list_add(&p->pidhash_list, &pidhash[pid_hashfn(p->pid)]);
-}
-
-static inline void unhash_pid(struct task_struct *p)
-{
-	list_del(&p->pidhash_list);
-}
-
+extern void hash_pid(task_t *);
+extern void unhash_pid(task_t *);
 extern task_t *find_task_by_pid(int pid);
 
 /* per-UID process charging. */
diff -urN linux-2.5.23-virgin/kernel/fork.c linux-2.5.23-wli/kernel/fork.c
--- linux-2.5.23-virgin/kernel/fork.c	Thu Jun 20 11:39:08 2002
+++ linux-2.5.23-wli/kernel/fork.c	Thu Jun 20 11:43:30 2002
@@ -69,6 +69,11 @@
 		INIT_LIST_HEAD(&pidhash[i]);
 }
 
+static inline unsigned pid_hashfn(pid_t pid)
+{
+	return ((pid >> 8) ^ pid) & (pidhash_size - 1);
+}
+
 task_t *find_task_by_pid(int pid)
 {
 	list_t *p, *pid_list = &pidhash[pid_hashfn(pid)];
@@ -82,7 +87,20 @@
 
 	return NULL;
 }
+
+void hash_pid(task_t *p)
+{
+	list_add(&p->pidhash_list, &pidhash[pid_hashfn(p->pid)]);
+}
+
+void unhash_pid(task_t *p)
+{
+	list_del(&p->pidhash_list);
+}
+
 EXPORT_SYMBOL(find_task_by_pid);
+EXPORT_SYMBOL(hash_pid);
+EXPORT_SYMBOL(unhash_pid);
 
 rwlock_t tasklist_lock __cacheline_aligned = RW_LOCK_UNLOCKED;  /* outer */
 
diff -urN linux-2.5.23-virgin/kernel/ksyms.c linux-2.5.23-wli/kernel/ksyms.c
--- linux-2.5.23-virgin/kernel/ksyms.c	Thu Jun 20 00:10:27 2002
+++ linux-2.5.23-wli/kernel/ksyms.c	Thu Jun 20 11:41:41 2002
@@ -602,5 +602,3 @@
 EXPORT_SYMBOL(init_thread_union);
 
 EXPORT_SYMBOL(tasklist_lock);
-EXPORT_SYMBOL(pidhash);
-EXPORT_SYMBOL(pidhash_size);

  reply	other threads:[~2002-06-20 19:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-19 11:23 Linux 2.5.23-dj1 Dave Jones
2002-06-19 23:36 ` [patch] scheduler bits from 2.5.23-dj1 Ingo Molnar
2002-06-19 23:47   ` Robert Love
2002-06-20  0:07     ` Andrea Arcangeli
2002-06-20  0:10       ` Robert Love
2002-06-19 23:47   ` Dave Jones
2002-06-20 17:20     ` William Lee Irwin III
2002-06-20 17:31       ` Ingo Molnar
2002-06-20 17:52         ` William Lee Irwin III
2002-06-20 18:17         ` William Lee Irwin III
2002-06-20 19:26           ` William Lee Irwin III [this message]
2002-06-21  1:34             ` William Lee Irwin III
2002-06-19 23:56   ` William Lee Irwin III
2002-06-20  7:26   ` Manik Raina
2002-06-20 13:13     ` Ingo Molnar
2002-06-20 13:34     ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2002-06-20 10:11 Mikael Pettersson

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=20020620192633.GZ22961@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=davej@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.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