[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250410092423.9831-4-alexs@kernel.org>
Date: Thu, 10 Apr 2025 17:24:19 +0800
From: alexs@...nel.org
To:
Cc: linux-kernel@...r.kernel.org,
Alex Shi <alexs@...nel.org>,
Valentin Schneider <vschneid@...hat.com>,
Ben Segall <bsegall@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Juri Lelli <juri.lelli@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Subject: [PATCH 4/4] sched/isolation: don't alloc twice for housekeeping.cpumasks
From: Alex Shi <alexs@...nel.org>
The variable housekeeping.cpumasks[type] will be alloced twice if
nohz_full and isolcpus are both setup in cmdline, that shouldn't to do
so. Just alloc once is enough and save a bit memory.
Signed-off-by: Alex Shi <alexs@...nel.org>
Cc: Valentin Schneider <vschneid@...hat.com>
Cc: Ben Segall <bsegall@...gle.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Dietmar Eggemann <dietmar.eggemann@....com>
Cc: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Juri Lelli <juri.lelli@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>
---
kernel/sched/isolation.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index e93776740725..44ab46b31f6b 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -103,10 +103,10 @@ void __init housekeeping_init(void)
static void __init housekeeping_setup_type(enum hk_type type,
cpumask_var_t housekeeping_staging)
{
+ if (cpumask_empty(housekeeping.cpumasks[type]))
+ alloc_bootmem_cpumask_var(&housekeeping.cpumasks[type]);
- alloc_bootmem_cpumask_var(&housekeeping.cpumasks[type]);
- cpumask_copy(housekeeping.cpumasks[type],
- housekeeping_staging);
+ cpumask_copy(housekeeping.cpumasks[type], housekeeping_staging);
}
static int __init housekeeping_setup(char *str, unsigned long flags)
--
2.47.1
Powered by blists - more mailing lists