From patchwork Mon Jan 29 10:06:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jinchao X-Patchwork-Id: 193388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp473607dyb; Mon, 29 Jan 2024 02:27:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoiICa+Fze4QGacTK0olZaAQlPd7cAg6NWg4ztZEjSLP3NAOgqND6vEaHfVjumapBmzwif X-Received: by 2002:a05:6358:2c83:b0:178:70ac:5a4f with SMTP id l3-20020a0563582c8300b0017870ac5a4fmr1249306rwm.27.1706524052562; Mon, 29 Jan 2024 02:27:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706524052; cv=pass; d=google.com; s=arc-20160816; b=XAhaOUPhBHpumr/0cEFuiDMA5WkZ+0bTADYQffIEf8GqCtE19Vgz7Ulo1H9Nd5MY+p 6uwZD7EIc4sdhGbaLmdU+S1bhS4cQIEfKUB16C6vvl8+Ym9s74zV2opobNkWGq6xhS1X YXk/SXpC2jCnS1mfbkW3rz5hyqUDhLE9Hhh32FyyMXmpnXlFwiBTFA4oN955UxuLBfJk JXclSwZntJW+oxtHUUY9JkvXopIsDWZHyfTyNMx79tz5Hm/5MBlUYFv1CpXlu/AhJpm6 M40xcvyF41WceamIb7uyGwbMgDkGnY9vqgoSV0XGBxX4dNOt77R86wE1YlDyRtzG13wo 0Rog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date; bh=WVXY/3j4JL/pslmHAW1Fvn+SHAY/NPG3QTdfgneqz5M=; fh=f40UFx4PIoN5VHjot5Te0Vsnl2epc2I3Vpkjl2f6MCo=; b=GKaoPLciaE7WQYOtEjZqEKvszjtr5Z0MfAWcoxApjVUM6K5oSpjypVvbof5qBlGAwD JcP9LyO2egPxtBe09UsFFi6cGrm8/MPzFXbRW8e+mdQSR7efB8JVEfdqdkkdRCKVmo4d g+xtwqPJdWEjAuOGiRYYcB4ZfH63UTt2AXAvN7Em4UtX7hmrQ/19MNiMkwb7Jdm/c/sT 3EgV66X3q6NHAF+BKrVzmxrbZ370YpNl1YpSiKARSK/Ar617iyY87MOJy4Jn8ZWK5bP/ ZLCrIkKc0pLCfzJT5ICd5qyQC7xcNQoMLqNe/4+Kj6rPklCWkCIHWFgtoEKvZ9iblk5h XRKw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-42534-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42534-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jo25-20020a056a00909900b006de3535b35esi666548pfb.129.2024.01.29.02.27.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 02:27:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42534-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-42534-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42534-ouuuleilei=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C921BB2242C for ; Mon, 29 Jan 2024 10:27:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10A8F56B98; Mon, 29 Jan 2024 10:27:09 +0000 (UTC) Received: from wxsgout04.xfusion.com (wxsgout03.xfusion.com [36.139.52.80]) (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 CF4705645F for ; Mon, 29 Jan 2024 10:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=36.139.52.80 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706524027; cv=none; b=DFHe4gK2KjjDogJKogaeRQC7bh5Syw/6TZfj7f9GMWEVNKXRMvUjCm9W5QDw6KbTw7OBPtqXWsbRj3M7TYqkWCXLnf4zRsKTZid+rWE+1OiDMjA5XfEtpHDPXtjpt0iJIGFZ/Nww/r4p4S49R7TG8vyTuRSzmfUEV8eMwAyadRg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706524027; c=relaxed/simple; bh=0pbNMZwQGIU61mp3Riq86bwoqCEQr3qg2nODWQqlvcU=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=pmevj28Gc/7Hj3L+1Tkh5VRfhrF7KyKkPz0DX3/NozSdgystWCWo1TnAt6GNMjLZJKb6sp8t7TuZkfjLx1JwjPgP9su5RWqfsll/sENhwQ0UF5kkiP/WL40oT/4VZogRAmKv2fjw2p8cOOJ/8i+BAGFfPW8f3x6xEyQHt5IcuPI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xfusion.com; spf=pass smtp.mailfrom=xfusion.com; arc=none smtp.client-ip=36.139.52.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xfusion.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xfusion.com Received: from wuxshcsitd00600.xfusion.com (unknown [10.32.133.213]) by wxsgout04.xfusion.com (SkyGuard) with ESMTPS id 4TNkTb0bxXzB0228; Mon, 29 Jan 2024 18:06:11 +0800 (CST) Received: from localhost (10.82.147.3) by wuxshcsitd00600.xfusion.com (10.32.133.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 29 Jan 2024 18:06:34 +0800 Date: Mon, 29 Jan 2024 18:06:33 +0800 From: Wang Jinchao To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , CC: , Subject: [PATCH] sched/core: Fix prio for fair in __task_prio Message-ID: <202401291802+0800-wangjinchao@xfusion.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-ClientProxiedBy: wuxshcsitd00600.xfusion.com (10.32.133.213) To wuxshcsitd00600.xfusion.com (10.32.133.213) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789419704134725117 X-GMAIL-MSGID: 1789420165217078283 It is said "120" in the comment, but MAX_RT_PRIO + MAX_NICE equals 119. DEFAULT_PRIO should be the right prio. Fix it and imodify the corresponding prio in prio_less. Signed-off-by: Wang Jinchao --- kernel/sched/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9116bcc90346..13484ee71e5b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -168,7 +168,7 @@ static inline int __task_prio(const struct task_struct *p) if (p->sched_class == &idle_sched_class) return MAX_RT_PRIO + NICE_WIDTH; /* 140 */ - return MAX_RT_PRIO + MAX_NICE; /* 120, squash fair */ + return DEFAULT_PRIO; /* 120, squash fair */ } /* @@ -194,7 +194,7 @@ static inline bool prio_less(const struct task_struct *a, if (pa == -1) /* dl_prio() doesn't work because of stop_class above */ return !dl_time_before(a->dl.deadline, b->dl.deadline); - if (pa == MAX_RT_PRIO + MAX_NICE) /* fair */ + if (pa == DEFAULT_PRIO) /* fair */ return cfs_prio_less(a, b, in_fi); return false;