mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "David S. Miller" <davem@redhat.com>
Cc: rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Simplify net/flow.c
Date: Thu, 22 Jan 2004 19:51:04 -0800	[thread overview]
Message-ID: <20040122195104.31cc2496.akpm@osdl.org> (raw)
In-Reply-To: <20040122101028.0eab2774.davem@redhat.com>

"David S. Miller" <davem@redhat.com> wrote:
>
> On Thu, 22 Jan 2004 18:49:37 +1100
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> 
> > 	I still have this cleanup sitting around, and frankly it gets
> > in the way for the hotplug CPU code.  It works fine here, and is
> > basically trivial, but I'm happy to put it in -mm first for wider
> > testing if you want?
> 
> No, I made you wait long enough with this patch :) and I just read it
> over again a few times and it looks perfectly fine.
> 
> So I'm applying this now, thanks Rusty.

It doesn't link if CONFIG_SMP=n.  semaphore `cpucontrol', used in
flow_cache_flush() is defined in kernel/cpu.c which is not included in
uniprocessor builds.

Here's one possible fix.


diff -puN net/core/flow.c~flow-cpucontrol-fix net/core/flow.c
--- 25/net/core/flow.c~flow-cpucontrol-fix	2004-01-22 19:39:54.000000000 -0800
+++ 25-akpm/net/core/flow.c	2004-01-22 19:43:58.000000000 -0800
@@ -286,7 +286,7 @@ void flow_cache_flush(void)
 
 	/* Don't want cpus going down or up during this, also protects
 	 * against multiple callers. */
-	down(&cpucontrol);
+	down_cpucontrol();
 	atomic_set(&info.cpuleft, num_online_cpus());
 	init_completion(&info.completion);
 
@@ -296,7 +296,7 @@ void flow_cache_flush(void)
 	local_bh_enable();
 
 	wait_for_completion(&info.completion);
-	up(&cpucontrol);
+	up_cpucontrol();
 }
 
 static void __devinit flow_cache_cpu_prepare(int cpu)
diff -puN include/linux/cpu.h~flow-cpucontrol-fix include/linux/cpu.h
--- 25/include/linux/cpu.h~flow-cpucontrol-fix	2004-01-22 19:42:23.000000000 -0800
+++ 25-akpm/include/linux/cpu.h	2004-01-22 19:43:35.000000000 -0800
@@ -37,7 +37,12 @@ extern int register_cpu_notifier(struct 
 extern void unregister_cpu_notifier(struct notifier_block *nb);
 
 int cpu_up(unsigned int cpu);
+
+#define down_cpucontrol()	down(&cpucontrol)
+#define up_cpucontrol()		up(&cpucontrol)
+
 #else
+
 static inline int register_cpu_notifier(struct notifier_block *nb)
 {
 	return 0;
@@ -45,6 +50,10 @@ static inline int register_cpu_notifier(
 static inline void unregister_cpu_notifier(struct notifier_block *nb)
 {
 }
+
+#define down_cpucontrol()	do { } while (0)
+#define up_cpucontrol()		do { } while (0)
+
 #endif /* CONFIG_SMP */
 extern struct sysdev_class cpu_sysdev_class;
 

_


  reply	other threads:[~2004-01-23  3:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-22  7:49 Rusty Russell
2004-01-22 18:10 ` David S. Miller
2004-01-23  3:51   ` Andrew Morton [this message]
2004-01-23  6:55     ` Rusty Russell
2004-01-24  5:30       ` David S. Miller
2004-01-23  7:16     ` David S. Miller

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=20040122195104.31cc2496.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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

all inboxes | Powered by JetHome®