netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: rds: don't pretend to use cpu notifiers
@ 2015-11-27 16:00 Sebastian Andrzej Siewior
  2015-11-30  1:44 ` santosh.shilimkar
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2015-11-27 16:00 UTC (permalink / raw)
  To: netdev; +Cc: Chien Yen, David S. Miller, rds-devel, Sebastian Andrzej Siewior

It looks like an attempt to use CPU notifier here which was never
completed. Nobody tried to wire it up completely since 2k9. So I unwind
this code and get rid of everything not required. Oh look! 19 lines were
removed while code still does the same thing.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/rds/page.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/net/rds/page.c b/net/rds/page.c
index 9005a2c920ee..5a14e6d6a926 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -179,37 +179,18 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
 }
 EXPORT_SYMBOL_GPL(rds_page_remainder_alloc);
 
-static int rds_page_remainder_cpu_notify(struct notifier_block *self,
-					 unsigned long action, void *hcpu)
+void rds_page_exit(void)
 {
-	struct rds_page_remainder *rem;
-	long cpu = (long)hcpu;
+	unsigned int cpu;
 
-	rem = &per_cpu(rds_page_remainders, cpu);
+	for_each_possible_cpu(cpu) {
+		struct rds_page_remainder *rem;
 
-	rdsdebug("cpu %ld action 0x%lx\n", cpu, action);
+		rem = &per_cpu(rds_page_remainders, cpu);
+		rdsdebug("cpu %u\n", cpu);
 
-	switch (action) {
-	case CPU_DEAD:
 		if (rem->r_page)
 			__free_page(rem->r_page);
 		rem->r_page = NULL;
-		break;
 	}
-
-	return 0;
-}
-
-static struct notifier_block rds_page_remainder_nb = {
-	.notifier_call = rds_page_remainder_cpu_notify,
-};
-
-void rds_page_exit(void)
-{
-	int i;
-
-	for_each_possible_cpu(i)
-		rds_page_remainder_cpu_notify(&rds_page_remainder_nb,
-					      (unsigned long)CPU_DEAD,
-					      (void *)(long)i);
 }
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: rds: don't pretend to use cpu notifiers
  2015-11-27 16:00 [PATCH] net: rds: don't pretend to use cpu notifiers Sebastian Andrzej Siewior
@ 2015-11-30  1:44 ` santosh.shilimkar
  0 siblings, 0 replies; 2+ messages in thread
From: santosh.shilimkar @ 2015-11-30  1:44 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, netdev; +Cc: Chien Yen, David S. Miller, rds-devel

Hi Sebastian,

On 11/27/15 8:00 AM, Sebastian Andrzej Siewior wrote:
> It looks like an attempt to use CPU notifier here which was never
> completed. Nobody tried to wire it up completely since 2k9. So I unwind
> this code and get rid of everything not required. Oh look! 19 lines were
> removed while code still does the same thing.
>
Indeed its true that RDS doesn't actually support the hot-plug so am
not surprised with the incompleteness of it.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>   net/rds/page.c | 31 ++++++-------------------------
>   1 file changed, 6 insertions(+), 25 deletions(-)
>
> diff --git a/net/rds/page.c b/net/rds/page.c
> index 9005a2c920ee..5a14e6d6a926 100644
> --- a/net/rds/page.c
> +++ b/net/rds/page.c
> @@ -179,37 +179,18 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
>   }
>   EXPORT_SYMBOL_GPL(rds_page_remainder_alloc);
>
> -static int rds_page_remainder_cpu_notify(struct notifier_block *self,
> -					 unsigned long action, void *hcpu)
> +void rds_page_exit(void)
>   {
> -	struct rds_page_remainder *rem;
> -	long cpu = (long)hcpu;
> +	unsigned int cpu;
>
> -	rem = &per_cpu(rds_page_remainders, cpu);
> +	for_each_possible_cpu(cpu) {
> +		struct rds_page_remainder *rem;
>
> -	rdsdebug("cpu %ld action 0x%lx\n", cpu, action);
> +		rem = &per_cpu(rds_page_remainders, cpu);
> +		rdsdebug("cpu %u\n", cpu);
>
> -	switch (action) {
> -	case CPU_DEAD:
>   		if (rem->r_page)
>   			__free_page(rem->r_page);
>   		rem->r_page = NULL;
> -		break;
>   	}
> -
> -	return 0;
> -}
> -
> -static struct notifier_block rds_page_remainder_nb = {
> -	.notifier_call = rds_page_remainder_cpu_notify,
> -};
> -
> -void rds_page_exit(void)
> -{
> -	int i;
> -
> -	for_each_possible_cpu(i)
> -		rds_page_remainder_cpu_notify(&rds_page_remainder_nb,
> -					      (unsigned long)CPU_DEAD,
> -					      (void *)(long)i);
>   }
>
Thanks for the cleanup. I don't have any objections as such on the
change and patch in general looks ok to me from first look. Just
want to make sure it works on my setup. If all goes well, I will
add this in my RDS queue for 4.5. Thanks !!

Regards,
Santosh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-30  1:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27 16:00 [PATCH] net: rds: don't pretend to use cpu notifiers Sebastian Andrzej Siewior
2015-11-30  1:44 ` santosh.shilimkar

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).