Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1514573 > unrolled thread

[PATCH 01/25] fs/buffer: Convert to hotplug state machine

Started bySebastian Andrzej Siewior <bigeasy@linutronix.de>
First post2016-11-03 16:00 +0100
Last post2016-11-10 17:40 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 01/25] fs/buffer: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-03 16:00 +0100
    [tip:smp/hotplug] fs/buffer: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-10 00:00 +0100
    Re: [PATCH 01/25] fs/buffer: Convert to hotplug state machine Al Viro <viro@ZenIV.linux.org.uk> - 2016-11-10 17:30 +0100
      Re: [PATCH 01/25] fs/buffer: Convert to hotplug state machine Thomas Gleixner <tglx@linutronix.de> - 2016-11-10 17:40 +0100

#1514573 — [PATCH 01/25] fs/buffer: Convert to hotplug state machine

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-11-03 16:00 +0100
Subject[PATCH 01/25] fs/buffer: Convert to hotplug state machine
Message-ID<szrEP-5cN-35@gated-at.bofh.it>
Install the callbacks via the state machine.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 fs/buffer.c                | 16 ++++++----------
 include/linux/cpuhotplug.h |  1 +
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index b205a629001d..1613656028d6 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3403,7 +3403,7 @@ void free_buffer_head(struct buffer_head *bh)
 }
 EXPORT_SYMBOL(free_buffer_head);
 
-static void buffer_exit_cpu(int cpu)
+static int buffer_exit_cpu_dead(unsigned int cpu)
 {
 	int i;
 	struct bh_lru *b = &per_cpu(bh_lrus, cpu);
@@ -3414,14 +3414,7 @@ static void buffer_exit_cpu(int cpu)
 	}
 	this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr);
 	per_cpu(bh_accounting, cpu).nr = 0;
-}
-
-static int buffer_cpu_notify(struct notifier_block *self,
-			      unsigned long action, void *hcpu)
-{
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
-		buffer_exit_cpu((unsigned long)hcpu);
-	return NOTIFY_OK;
+	return 0;
 }
 
 /**
@@ -3471,6 +3464,7 @@ EXPORT_SYMBOL(bh_submit_read);
 void __init buffer_init(void)
 {
 	unsigned long nrpages;
+	int ret;
 
 	bh_cachep = kmem_cache_create("buffer_head",
 			sizeof(struct buffer_head), 0,
@@ -3483,5 +3477,7 @@ void __init buffer_init(void)
 	 */
 	nrpages = (nr_free_buffer_pages() * 10) / 100;
 	max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head));
-	hotcpu_notifier(buffer_cpu_notify, 0);
+	ret = cpuhp_setup_state_nocalls(CPUHP_FS_BUFF_DEAD, "fs/buffer:dead",
+					NULL, buffer_exit_cpu_dead);
+	WARN_ON(ret < 0);
 }
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index afe641c02dca..69b74fa0da60 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -30,6 +30,7 @@ enum cpuhp_state {
 	CPUHP_ACPI_CPUDRV_DEAD,
 	CPUHP_S390_PFAULT_DEAD,
 	CPUHP_BLK_MQ_DEAD,
+	CPUHP_FS_BUFF_DEAD,
 	CPUHP_WORKQUEUE_PREP,
 	CPUHP_POWER_NUMA_PREPARE,
 	CPUHP_HRTIMERS_PREPARE,
-- 
2.10.2

[toc] | [next] | [standalone]


#1518538 — [tip:smp/hotplug] fs/buffer: Convert to hotplug state machine

Fromtip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com>
Date2016-11-10 00:00 +0100
Subject[tip:smp/hotplug] fs/buffer: Convert to hotplug state machine
Message-ID<sBK0x-5k0-7@gated-at.bofh.it>
In reply to#1514573
Commit-ID:  fc4d24c9b47150245b3eb5bebc2ad4764c754ef4
Gitweb:     http://git.kernel.org/tip/fc4d24c9b47150245b3eb5bebc2ad4764c754ef4
Author:     Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Thu, 3 Nov 2016 15:49:57 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 9 Nov 2016 23:45:25 +0100

fs/buffer: Convert to hotplug state machine

Install the callbacks via the state machine.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161103145021.28528-2-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 fs/buffer.c                | 16 ++++++----------
 include/linux/cpuhotplug.h |  1 +
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index b205a62..1613656 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3403,7 +3403,7 @@ void free_buffer_head(struct buffer_head *bh)
 }
 EXPORT_SYMBOL(free_buffer_head);
 
-static void buffer_exit_cpu(int cpu)
+static int buffer_exit_cpu_dead(unsigned int cpu)
 {
 	int i;
 	struct bh_lru *b = &per_cpu(bh_lrus, cpu);
@@ -3414,14 +3414,7 @@ static void buffer_exit_cpu(int cpu)
 	}
 	this_cpu_add(bh_accounting.nr, per_cpu(bh_accounting, cpu).nr);
 	per_cpu(bh_accounting, cpu).nr = 0;
-}
-
-static int buffer_cpu_notify(struct notifier_block *self,
-			      unsigned long action, void *hcpu)
-{
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN)
-		buffer_exit_cpu((unsigned long)hcpu);
-	return NOTIFY_OK;
+	return 0;
 }
 
 /**
@@ -3471,6 +3464,7 @@ EXPORT_SYMBOL(bh_submit_read);
 void __init buffer_init(void)
 {
 	unsigned long nrpages;
+	int ret;
 
 	bh_cachep = kmem_cache_create("buffer_head",
 			sizeof(struct buffer_head), 0,
@@ -3483,5 +3477,7 @@ void __init buffer_init(void)
 	 */
 	nrpages = (nr_free_buffer_pages() * 10) / 100;
 	max_buffer_heads = nrpages * (PAGE_SIZE / sizeof(struct buffer_head));
-	hotcpu_notifier(buffer_cpu_notify, 0);
+	ret = cpuhp_setup_state_nocalls(CPUHP_FS_BUFF_DEAD, "fs/buffer:dead",
+					NULL, buffer_exit_cpu_dead);
+	WARN_ON(ret < 0);
 }
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index afe641c..69b74fa 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -30,6 +30,7 @@ enum cpuhp_state {
 	CPUHP_ACPI_CPUDRV_DEAD,
 	CPUHP_S390_PFAULT_DEAD,
 	CPUHP_BLK_MQ_DEAD,
+	CPUHP_FS_BUFF_DEAD,
 	CPUHP_WORKQUEUE_PREP,
 	CPUHP_POWER_NUMA_PREPARE,
 	CPUHP_HRTIMERS_PREPARE,

[toc] | [prev] | [next] | [standalone]


#1519107

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2016-11-10 17:30 +0100
Message-ID<sC0oF-as-1@gated-at.bofh.it>
In reply to#1514573
On Thu, Nov 03, 2016 at 03:49:57PM +0100, Sebastian Andrzej Siewior wrote:
> Install the callbacks via the state machine.

> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index afe641c02dca..69b74fa0da60 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -30,6 +30,7 @@ enum cpuhp_state {
>  	CPUHP_ACPI_CPUDRV_DEAD,
>  	CPUHP_S390_PFAULT_DEAD,
>  	CPUHP_BLK_MQ_DEAD,
> +	CPUHP_FS_BUFF_DEAD,
>  	CPUHP_WORKQUEUE_PREP,
>  	CPUHP_POWER_NUMA_PREPARE,
>  	CPUHP_HRTIMERS_PREPARE,

*ouch*

So we are getting a large list of things from unrelated subsystems, maintained
in a single place, all next to each other.  All examples of that sort of
thing I can recall had ended up biting our arses...

[toc] | [prev] | [next] | [standalone]


#1519125

FromThomas Gleixner <tglx@linutronix.de>
Date2016-11-10 17:40 +0100
Message-ID<sC0yl-dI-15@gated-at.bofh.it>
In reply to#1519107
On Thu, 10 Nov 2016, Al Viro wrote:

> On Thu, Nov 03, 2016 at 03:49:57PM +0100, Sebastian Andrzej Siewior wrote:
> > Install the callbacks via the state machine.
> 
> > diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> > index afe641c02dca..69b74fa0da60 100644
> > --- a/include/linux/cpuhotplug.h
> > +++ b/include/linux/cpuhotplug.h
> > @@ -30,6 +30,7 @@ enum cpuhp_state {
> >  	CPUHP_ACPI_CPUDRV_DEAD,
> >  	CPUHP_S390_PFAULT_DEAD,
> >  	CPUHP_BLK_MQ_DEAD,
> > +	CPUHP_FS_BUFF_DEAD,
> >  	CPUHP_WORKQUEUE_PREP,
> >  	CPUHP_POWER_NUMA_PREPARE,
> >  	CPUHP_HRTIMERS_PREPARE,
> 
> *ouch*
> 
> So we are getting a large list of things from unrelated subsystems, maintained
> in a single place, all next to each other.  All examples of that sort of
> thing I can recall had ended up biting our arses...

I rather have my arse bitten by a few merge conflicts than constantly
chasing why odering by chance, link order or magic constants in random
files make things explode or not work.

Thanks,

	tglx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web