diff mbox series

[v3,6/9] sched/core: Merge cpumask_andnot()+for_each_cpu() into for_each_cpu_andnot()

Message ID 20220825181210.284283-7-vschneid@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series sched, net: NUMA-aware CPU spreading interface | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 51 this patch: 51
netdev/cc_maintainers warning 4 maintainers not CCed: mingo@redhat.com bristot@redhat.com bsegall@google.com juri.lelli@redhat.com
netdev/build_clang success Errors and warnings before: 6 this patch: 6
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 53 this patch: 53
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Valentin Schneider Aug. 25, 2022, 6:12 p.m. UTC
This removes the second use of the sched_core_mask temporary mask.

Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
 kernel/sched/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Yury Norov Aug. 25, 2022, 9:16 p.m. UTC | #1
On Thu, Aug 25, 2022 at 07:12:07PM +0100, Valentin Schneider wrote:
> This removes the second use of the sched_core_mask temporary mask.
> 
> Signed-off-by: Valentin Schneider <vschneid@redhat.com>

Suggested-by: Yury Norov <yury.norov@gmail.com>

> ---
>  kernel/sched/core.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index ee28253c9ac0..b4c3112b0095 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -360,10 +360,7 @@ static void __sched_core_flip(bool enabled)
>  	/*
>  	 * Toggle the offline CPUs.
>  	 */
> -	cpumask_copy(&sched_core_mask, cpu_possible_mask);
> -	cpumask_andnot(&sched_core_mask, &sched_core_mask, cpu_online_mask);
> -
> -	for_each_cpu(cpu, &sched_core_mask)
> +	for_each_cpu_andnot(cpu, cpu_possible_mask, cpu_online_mask)
>  		cpu_rq(cpu)->core_enabled = enabled;
>  
>  	cpus_read_unlock();
> -- 
> 2.31.1
Valentin Schneider Aug. 25, 2022, 11:20 p.m. UTC | #2
On 25/08/22 14:16, Yury Norov wrote:
> On Thu, Aug 25, 2022 at 07:12:07PM +0100, Valentin Schneider wrote:
>> This removes the second use of the sched_core_mask temporary mask.
>>
>> Signed-off-by: Valentin Schneider <vschneid@redhat.com>
>
> Suggested-by: Yury Norov <yury.norov@gmail.com>
>

Indeed, forgot that one, sorry!
diff mbox series

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ee28253c9ac0..b4c3112b0095 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -360,10 +360,7 @@  static void __sched_core_flip(bool enabled)
 	/*
 	 * Toggle the offline CPUs.
 	 */
-	cpumask_copy(&sched_core_mask, cpu_possible_mask);
-	cpumask_andnot(&sched_core_mask, &sched_core_mask, cpu_online_mask);
-
-	for_each_cpu(cpu, &sched_core_mask)
+	for_each_cpu_andnot(cpu, cpu_possible_mask, cpu_online_mask)
 		cpu_rq(cpu)->core_enabled = enabled;
 
 	cpus_read_unlock();