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


Groups > linux.kernel > #1182181 > unrolled thread

[PATCH 0/4] smpboot/watchdog: Fixes and cleanups v2

Started byFrederic Weisbecker <fweisbec@gmail.com>
First post2015-07-11 18:00 +0200
Last post2015-07-11 18:00 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] smpboot/watchdog: Fixes and cleanups v2 Frederic Weisbecker <fweisbec@gmail.com> - 2015-07-11 18:00 +0200
    [PATCH 1/4] smpboot: Fix memory leak on error handling Frederic Weisbecker <fweisbec@gmail.com> - 2015-07-11 18:00 +0200
    [PATCH 3/4] smpboot: Allow to pass the cpumask on per-cpu thread registration Frederic Weisbecker <fweisbec@gmail.com> - 2015-07-11 18:00 +0200

#1182181 — [PATCH 0/4] smpboot/watchdog: Fixes and cleanups v2

FromFrederic Weisbecker <fweisbec@gmail.com>
Date2015-07-11 18:00 +0200
Subject[PATCH 0/4] smpboot/watchdog: Fixes and cleanups v2
Message-ID<pL5m2-4Xo-21@gated-at.bofh.it>
Changes in v2:

* Fix typos reported by Chris
* Fix comment header, reported by Ulrich Obergfell
* Add reviewed-by tag

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
	core/watchdog-v2

HEAD: b7528d521f33567eaeb7fb74a807db125e161d42

Thanks,
	Frederic
---

Frederic Weisbecker (4):
      smpboot: Fix memory leak on error handling
      smpboot: Make cleanup to mirror setup
      smpboot: Allow to pass the cpumask on per-cpu thread registration
      watchdog: Simplify housekeeping affinity with the appropriate mask


 include/linux/smpboot.h | 11 ++++++++++-
 kernel/smpboot.c        | 25 +++++++++++--------------
 kernel/watchdog.c       | 15 +++++----------
 3 files changed, 26 insertions(+), 25 deletions(-)
--
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/

[toc] | [next] | [standalone]


#1182182 — [PATCH 1/4] smpboot: Fix memory leak on error handling

FromFrederic Weisbecker <fweisbec@gmail.com>
Date2015-07-11 18:00 +0200
Subject[PATCH 1/4] smpboot: Fix memory leak on error handling
Message-ID<pL5m2-4Xo-31@gated-at.bofh.it>
In reply to#1182181
The cpumask is allocated before threads get created. If the latter step
fails, we need to free the cpumask.

Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/smpboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 7c434c3..71aa90b 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -301,6 +301,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 		ret = __smpboot_create_thread(plug_thread, cpu);
 		if (ret) {
 			smpboot_destroy_threads(plug_thread);
+			free_cpumask_var(plug_thread->cpumask);
 			goto out;
 		}
 		smpboot_unpark_thread(plug_thread, cpu);
-- 
2.1.4

--
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/

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


#1182184 — [PATCH 3/4] smpboot: Allow to pass the cpumask on per-cpu thread registration

FromFrederic Weisbecker <fweisbec@gmail.com>
Date2015-07-11 18:00 +0200
Subject[PATCH 3/4] smpboot: Allow to pass the cpumask on per-cpu thread registration
Message-ID<pL5m3-4Xo-41@gated-at.bofh.it>
In reply to#1182181
It makes the registration cheaper and simpler for the smpboot per-cpu
kthread users that don't need to always update the cpumask after threads
creation.

Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 include/linux/smpboot.h | 11 ++++++++++-
 kernel/smpboot.c        | 12 ++++++++----
 kernel/watchdog.c       |  9 +++------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index da3c593..e6109a6 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -48,7 +48,16 @@ struct smp_hotplug_thread {
 	const char			*thread_comm;
 };
 
-int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
+int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread,
+					   const struct cpumask *cpumask);
+
+static inline int
+smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
+{
+	return smpboot_register_percpu_thread_cpumask(plug_thread,
+						      cpu_possible_mask);
+}
+
 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
 int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread *plug_thread,
 					 const struct cpumask *);
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 60aa858..d99a41d 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -273,19 +273,22 @@ static void smpboot_destroy_threads(struct smp_hotplug_thread *ht)
 }
 
 /**
- * smpboot_register_percpu_thread - Register a per_cpu thread related to hotplug
+ * smpboot_register_percpu_thread_cpumask - Register a per_cpu thread related
+ * 					    to hotplug
  * @plug_thread:	Hotplug thread descriptor
+ * @cpumask:		The cpumask where threads run
  *
  * Creates and starts the threads on all online cpus.
  */
-int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
+int smpboot_register_percpu_thread_cpumask(struct smp_hotplug_thread *plug_thread,
+					   const struct cpumask *cpumask)
 {
 	unsigned int cpu;
 	int ret = 0;
 
 	if (!alloc_cpumask_var(&plug_thread->cpumask, GFP_KERNEL))
 		return -ENOMEM;
-	cpumask_copy(plug_thread->cpumask, cpu_possible_mask);
+	cpumask_copy(plug_thread->cpumask, cpumask);
 
 	get_online_cpus();
 	mutex_lock(&smpboot_threads_lock);
@@ -296,7 +299,8 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 			free_cpumask_var(plug_thread->cpumask);
 			goto out;
 		}
-		smpboot_unpark_thread(plug_thread, cpu);
+		if (cpumask_test_cpu(cpu, cpumask))
+			smpboot_unpark_thread(plug_thread, cpu);
 	}
 	list_add(&plug_thread->list, &hotplug_threads);
 out:
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index a6ffa43..e5bb86f 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -713,15 +713,12 @@ static int watchdog_enable_all_cpus(void)
 	int err = 0;
 
 	if (!watchdog_running) {
-		err = smpboot_register_percpu_thread(&watchdog_threads);
+		err = smpboot_register_percpu_thread_cpumask(&watchdog_threads,
+							     &watchdog_cpumask);
 		if (err)
 			pr_err("Failed to create watchdog threads, disabled\n");
-		else {
-			if (smpboot_update_cpumask_percpu_thread(
-				    &watchdog_threads, &watchdog_cpumask))
-				pr_err("Failed to set cpumask for watchdog threads\n");
+		else
 			watchdog_running = 1;
-		}
 	} else {
 		/*
 		 * Enable/disable the lockup detectors or
-- 
2.1.4

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web