From patchwork Fri Feb 16 09:20:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 202010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp393448dyb; Fri, 16 Feb 2024 01:21:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUH96QPxextlE1wY82z9NNUPqNGS03XrBm9WVTXyO3say4AAk8f36CgyeaPr+oDk4UkdHDhgTm4Xb3onsaKmjJj6GpfEg== X-Google-Smtp-Source: AGHT+IG3JvgJztqa6CmBnGMks62qhxKHI3tv25AHPYGHzK4tKVwS77IsFngexzIVgH5a1XOq4yHb X-Received: by 2002:a1f:ea01:0:b0:4bd:58d0:c892 with SMTP id i1-20020a1fea01000000b004bd58d0c892mr4237995vkh.7.1708075272917; Fri, 16 Feb 2024 01:21:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708075272; cv=pass; d=google.com; s=arc-20160816; b=qY58hZmhTRl9qhZcmN01qi8CYBAr/htY0Ukc0SeJ0CSR9TgeoqtMX8RuiG7aawxC4x NaQBGhOF9AxQFOQaKgwdAlRtz87QiUpFD7ynyv/jXguecrWFzquKUqqsq4IvGa5c560n 7QKS0Y1Rn893nHOltFsf9xxcQeroGlRmT6mlHEWJautGD+ncnTWbn6KrfsuAgfV21JJ0 A21NBljEfwoexZd2BZOoU237aI1Hlxo1ZfS/4CHOoTSYRi4A44v62I/PamLpVfCAS3lu ILeFx+LMZiZQwteoWl8WaZ/vRfaqTldHdwh5u7GwGQFV/sx5N3ckWnzxByHIx7GytB5p 11Gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=i0VeBzoJh9QD78pHNrI9e6Wlof8o7nvhKh2UMUiADUg=; fh=I0pZMxrvsJVW7BahYHezmiDBWCaV5tSYcSKgtCR/Aas=; b=ExxCP7RHTrQtMw1UdOTZGKJFHd+x9VzeqssYPzDQTFKXYUm98JUHM/oymOZFxaicyR Sbj7RnzT20r25j2nopD6P5iOV4wb5rtQ5Ha8IQUCIyEY7W0t9gVIunXcdNM0dNAdNXhC 0RXXyn5/pAzAdBxCM4yVSS1DerxJ5QWhRyTIcG1mdIa2dkQLitx6rq8KoKss7VvFGahA H7y11erg3gt+AlIpp/inhxMYX19R/kYVtUm0kCbrHBPjHVzv1HEeULw3/Jz6givcEAlK fLR7syzDU8a3CYHzwhgxiEpKF8RTwRjhFwoFHbcMtyB8+PHf/LYvOYe3A3OKD5SBe+do mVDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CsMiAhik; dkim=neutral (no key) header.i=@linutronix.de; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68324-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q1-20020a056214194100b0068f33402864si767352qvk.220.2024.02.16.01.21.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 01:21:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CsMiAhik; dkim=neutral (no key) header.i=@linutronix.de; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68324-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68324-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B2A6C1C2197A for ; Fri, 16 Feb 2024 09:21:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F1951BC2F; Fri, 16 Feb 2024 09:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CsMiAhik"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="E9k5Qe05" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41B071B81A; Fri, 16 Feb 2024 09:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708075258; cv=none; b=BRAEMpEuoFX1NfyFuTMFEvoVWvu7Y9gu3NkyF8kQ52xnM+w/nQ16ArENN4g2FAazTEeZBYt0ueeBXNq3O5paIf75vLlWZHXPet603yjZnxR58uFzPPbHp2OI6phIopqMG7czLZDOZkOXRmhST6uVuZE9nfy2QKohZzX1phFn3eM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708075258; c=relaxed/simple; bh=RY5XxsCnyG2c3FxZcPo9EhUyfPW5xM36aDUFL59XXeg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=QjbDXX3dfPsQMy6xOw95hfgbIjX+skUTzyFM0jQUUTknHDmeV/8NLETKaLBVD5EzwKXF2yHZs5L09VoWuyw2QA6D0aFmAYe6DKG4B3M7mY1speZbP0Fpfg37Q7XEcg92pXLQzAszwk8zf828sqYGA203GO51QlYzD0d+xz12dtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CsMiAhik; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=E9k5Qe05; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 16 Feb 2024 09:20:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708075255; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0VeBzoJh9QD78pHNrI9e6Wlof8o7nvhKh2UMUiADUg=; b=CsMiAhikZoErEjyDDXP2JDHdvvju5tXQTjffD5V1ldBR1xACJQ/GwMeL3K0ZWLDE1zQ08y N6FzT85nTfYLir4A2Le1M8Gh9FWsaFnO6FJwX7gclvpGdaXi2NrVBASQBw/2nK5Z/PCwQV FysGZnBufmjSh5UJWS2c9FheV2Lv+ydkfyh1SUoxv14vaJaS98bWVy2xZZnCr/IHakXq9q 8deccZird7YB3i0YoKbn6MxKpR8gI+mnvfNnrwNRcw4Umr0beI4YsKIpHzzCzgEez/GTTV IdWB1G1v0Yj0LSl8IfMRHIqq+ihZO9UWyXyi3OROPaS32z2Q/mFPKxJklRxxPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708075255; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i0VeBzoJh9QD78pHNrI9e6Wlof8o7nvhKh2UMUiADUg=; b=E9k5Qe05TWd5/SV/UqerYzNl7RBxjYk/Xj9a7dl69dpvQjW2C2w06/GZ+qKts4sd07yumW V0UlWwgqCvgVvADg== From: "tip-bot2 for Shrikanth Hegde" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/core: Simplify code by removing duplicate #ifdefs Cc: Shrikanth Hegde , Ingo Molnar , Vincent Guittot , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240216061433.535522-1-sshegde@linux.ibm.com> References: <20240216061433.535522-1-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170807525377.398.6140727129795526147.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791046737199128996 X-GMAIL-MSGID: 1791046737199128996 The following commit has been merged into the sched/core branch of tip: Commit-ID: 8cec3dd9e5930c82c6bd0af3fdb3a36bcd428310 Gitweb: https://git.kernel.org/tip/8cec3dd9e5930c82c6bd0af3fdb3a36bcd428310 Author: Shrikanth Hegde AuthorDate: Fri, 16 Feb 2024 11:44:33 +05:30 Committer: Ingo Molnar CommitterDate: Fri, 16 Feb 2024 09:37:15 +01:00 sched/core: Simplify code by removing duplicate #ifdefs There's a few cases of nested #ifdefs in the scheduler code that can be simplified: #ifdef DEFINE_A ...code block... #ifdef DEFINE_A <-- This is a duplicate. ...code block... #endif #else #ifndef DEFINE_A <-- This is also duplicate. ...code block... #endif #endif More details about the script and methods used to find these code patterns can be found at: https://lore.kernel.org/all/20240118080326.13137-1-sshegde@linux.ibm.com/ No change in functionality intended. [ mingo: Clarified the changelog. ] Signed-off-by: Shrikanth Hegde Signed-off-by: Ingo Molnar Reviewed-by: Vincent Guittot Link: https://lore.kernel.org/r/20240216061433.535522-1-sshegde@linux.ibm.com --- kernel/sched/core.c | 4 +--- kernel/sched/fair.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9116bcc..a76c709 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1792,7 +1792,6 @@ static void cpu_util_update_eff(struct cgroup_subsys_state *css); #endif #ifdef CONFIG_SYSCTL -#ifdef CONFIG_UCLAMP_TASK #ifdef CONFIG_UCLAMP_TASK_GROUP static void uclamp_update_root_tg(void) { @@ -1898,7 +1897,6 @@ undo: return result; } #endif -#endif static int uclamp_validate(struct task_struct *p, const struct sched_attr *attr) @@ -2065,7 +2063,7 @@ static void __init init_uclamp(void) } } -#else /* CONFIG_UCLAMP_TASK */ +#else /* !CONFIG_UCLAMP_TASK */ static inline void uclamp_rq_inc(struct rq *rq, struct task_struct *p) { } static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) { } static inline int uclamp_validate(struct task_struct *p, diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 533547e..8e30e2b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10182,10 +10182,8 @@ static int idle_cpu_without(int cpu, struct task_struct *p) * be computed and tested before calling idle_cpu_without(). */ -#ifdef CONFIG_SMP if (rq->ttwu_pending) return 0; -#endif return 1; }