From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753453AbdFPKkU (ORCPT ); Fri, 16 Jun 2017 06:40:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53828 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752651AbdFPKkR (ORCPT ); Fri, 16 Jun 2017 06:40:17 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D5CA9624A8 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=bristot@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D5CA9624A8 From: Daniel Bristot de Oliveira To: linux-rt-users@vger.kernel.org Cc: "Luis Claudio R . Goncalves" , Clark Williams , Luiz Capitulino , Sebastian Andrzej Siewior , Thomas Gleixner , Steven Rostedt , Peter Zijlstra , LKML Subject: [RFC 2/3] rt: Update nr_cpus_allowed if the affinity of a task changes while its migration is disabled Date: Fri, 16 Jun 2017 12:39:47 +0200 Message-Id: In-Reply-To: References: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 16 Jun 2017 10:40:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, if the affinity of a task changes when it is with migration disabled, the nr_cpus_allowed is not being updated, creating an inconsistency between nr_cpus_allowed and cpumask_weight(cpus_allowed) This patch fixes this problem by calling set_cpus_allowed_common() if the cpumask of a task changes while it is with migration disable. Signed-off-by: Daniel Bristot de Oliveira Cc: Luis Claudio R. Goncalves Cc: Clark Williams Cc: Luiz Capitulino Cc: Sebastian Andrzej Siewior Cc: Thomas Gleixner Cc: Steven Rostedt Cc: Peter Zijlstra Cc: LKML Cc: linux-rt-users --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index aeb3e12..0396bf2 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1146,7 +1146,7 @@ void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) lockdep_assert_held(&p->pi_lock); if (__migrate_disabled(p)) { - cpumask_copy(&p->cpus_allowed, new_mask); + set_cpus_allowed_common(p, new_mask); return; } -- 2.9.4