From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C134BECDE46 for ; Thu, 25 Oct 2018 18:42:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90E7A20834 for ; Thu, 25 Oct 2018 18:42:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90E7A20834 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727630AbeJZDQn (ORCPT ); Thu, 25 Oct 2018 23:16:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52272 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727428AbeJZDQm (ORCPT ); Thu, 25 Oct 2018 23:16:42 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9PIYQ06031464 for ; Thu, 25 Oct 2018 14:42:46 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nbhmq4nnr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Oct 2018 14:42:46 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Oct 2018 19:42:44 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 25 Oct 2018 19:42:39 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9PIgdSU36569196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Oct 2018 18:42:39 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2B42A4040; Thu, 25 Oct 2018 18:42:38 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF9C8A405B; Thu, 25 Oct 2018 18:42:36 +0000 (GMT) Received: from srikart450.in.ibm.com (unknown [9.102.3.165]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Oct 2018 18:42:36 +0000 (GMT) From: Srikar Dronamraju To: Ingo Molnar , Peter Zijlstra Cc: LKML , Mel Gorman , Rik van Riel , Srikar Dronamraju , Thomas Gleixner , Wang , zhong.weidong@zte.com.cn, Yi Liu , Frederic Weisbecker Subject: [PATCH v3 3/3] sched/core: Error out if cpumask has a mix of isolcpus and housekeeping CPUs Date: Fri, 26 Oct 2018 00:12:23 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540492943-17147-1-git-send-email-srikar@linux.vnet.ibm.com> References: <1540492943-17147-1-git-send-email-srikar@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18102518-0016-0000-0000-00000219B75F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18102518-0017-0000-0000-00003271C0D1 Message-Id: <1540492943-17147-4-git-send-email-srikar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-25_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810250155 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return EINVAL, if the user has passed a mix of isolcpus and housekeeping CPUs in cpumask to sched_setaffinity(). This will ensure that users are notified so that they can take corrective actions to ensure consistent behaviour. This might cause a change in sched_setaffinity behaviour when isolcpus is set. Suggested-by: Mel Gorman Signed-off-by: Srikar Dronamraju --- kernel/sched/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 37e62b8..3842471 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4798,9 +4798,12 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) * housekeeping_cpumask */ if (!cpumask_subset(new_mask, hk_mask) && - cpumask_intersects(new_mask, hk_mask)) + cpumask_intersects(new_mask, hk_mask)) { pr_warn("pid %d: Mix of isolcpus and non-isolcpus provided\n", p->pid); + retval = -EINVAL; + goto out_free_new_mask; + } /* * Since bandwidth control happens on root_domain basis, -- 1.8.3.1