forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sched/isolation: Move housekeeping related code to its own file
The housekeeping code is currently tied to the NOHZ code. As we are planning to make housekeeping independent from it, start with moving the relevant code to its own file. Signed-off-by: Frederic Weisbecker <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Luiz Capitulino <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Wanpeng Li <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
- Loading branch information
Frederic Weisbecker
authored and
Ingo Molnar
committed
Oct 27, 2017
1 parent
54b933c
commit 7863406
Showing
12 changed files
with
98 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef _LINUX_SCHED_ISOLATION_H | ||
#define _LINUX_SCHED_ISOLATION_H | ||
|
||
#include <linux/cpumask.h> | ||
#include <linux/init.h> | ||
#include <linux/tick.h> | ||
|
||
#ifdef CONFIG_NO_HZ_FULL | ||
extern cpumask_var_t housekeeping_mask; | ||
|
||
static inline int housekeeping_any_cpu(void) | ||
{ | ||
return cpumask_any_and(housekeeping_mask, cpu_online_mask); | ||
} | ||
|
||
extern void __init housekeeping_init(void); | ||
|
||
#else | ||
|
||
static inline int housekeeping_any_cpu(void) | ||
{ | ||
return smp_processor_id(); | ||
} | ||
|
||
static inline void housekeeping_init(void) { } | ||
#endif /* CONFIG_NO_HZ_FULL */ | ||
|
||
|
||
static inline const struct cpumask *housekeeping_cpumask(void) | ||
{ | ||
#ifdef CONFIG_NO_HZ_FULL | ||
if (tick_nohz_full_enabled()) | ||
return housekeeping_mask; | ||
#endif | ||
return cpu_possible_mask; | ||
} | ||
|
||
static inline bool is_housekeeping_cpu(int cpu) | ||
{ | ||
#ifdef CONFIG_NO_HZ_FULL | ||
if (tick_nohz_full_enabled()) | ||
return cpumask_test_cpu(cpu, housekeeping_mask); | ||
#endif | ||
return true; | ||
} | ||
|
||
static inline void housekeeping_affine(struct task_struct *t) | ||
{ | ||
#ifdef CONFIG_NO_HZ_FULL | ||
if (tick_nohz_full_enabled()) | ||
set_cpus_allowed_ptr(t, housekeeping_mask); | ||
|
||
#endif | ||
} | ||
|
||
#endif /* _LINUX_SCHED_ISOLATION_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Housekeeping management. Manage the targets for routine code that can run on | ||
* any CPU: unbound workqueues, timers, kthreads and any offloadable work. | ||
* | ||
* Copyright (C) 2017 Red Hat, Inc., Frederic Weisbecker | ||
* | ||
*/ | ||
|
||
#include <linux/sched/isolation.h> | ||
#include <linux/tick.h> | ||
#include <linux/init.h> | ||
#include <linux/kernel.h> | ||
|
||
cpumask_var_t housekeeping_mask; | ||
|
||
void __init housekeeping_init(void) | ||
{ | ||
if (!tick_nohz_full_enabled()) | ||
return; | ||
|
||
if (!alloc_cpumask_var(&housekeeping_mask, GFP_KERNEL)) { | ||
WARN(1, "NO_HZ: Can't allocate not-full dynticks cpumask\n"); | ||
cpumask_clear(tick_nohz_full_mask); | ||
tick_nohz_full_running = false; | ||
return; | ||
} | ||
|
||
cpumask_andnot(housekeeping_mask, | ||
cpu_possible_mask, tick_nohz_full_mask); | ||
|
||
/* We need at least one CPU to handle housekeeping work */ | ||
WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters