From patchwork Mon Jan 29 10:19:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Jinchao X-Patchwork-Id: 193387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp470833dyb; Mon, 29 Jan 2024 02:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IH65ppnL5JshQInm8d5XNsIsSpr232OvctGH4vj/B2mV4gGdOvlJA/Vx8Frau5zNRFV2Gwb X-Received: by 2002:a05:622a:5c8:b0:429:f6bf:3b70 with SMTP id d8-20020a05622a05c800b00429f6bf3b70mr6033819qtb.55.1706523612861; Mon, 29 Jan 2024 02:20:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706523612; cv=pass; d=google.com; s=arc-20160816; b=S3GRuVM3NUq8wweH+hDqXR/i7BzDfqQt92R9DtzpV/zQPq3w5aUQihLiRWkdIjqGzQ dHqPzcTWc0FSj0Pjlh9ZdPwNVLfEFXwUQqglB/R+pQ9WLtTo12qyeSfj68v8Ge/EJmFd 0FDqrmle/fDgUvIH7x7zlgtWgC9cTh9/i6vJuBi2lsT2WnLo56JWjM4LSmuK8SkXEDyc fRW8ZrTZuC6nEkSWlk99RpExecr6/qvL9BAM4jN4VRTGjYK/dSN+qioYiPTTGNF/L/iD +1j2m0NVoFjA0HPahdvhyR9HTTgXN5zcinig1Y0UOchivRm8BFmSUEA+vwb/NTc4+1Np jjcQ== 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=FN0bNrDfeUqEB2Gs0Exc6wLIJEMUVLcu/Hhnovq67G1pkGqdlEeKpk/DpWFMnks/Jj +QG41lNGlAL73m08cmmsHmmG8+J6Cs8d/o6a0XwbZ7sCFnIvTI9L02OgnbVdUXCw2yzy OLmP4fbm5P2qNVICZ2k0Wfau53JPrPUROBUgwtHbtJwZTvEq/xZ12zYnwoKuL89Cq+f0 qWheR0++0/a8ZTXA2UIRdaihpv4jTT7EBHkPkmbjWgsfYDkefMuCUhXSlaxPpuP03p2W t6ZmPrPhsZbI22G0rITXTnA/u8f0iFGUgBOlqFTk9LFO6HWsZwJ8cD/IJuzGw5f/tfn/ bsxA== 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-42527-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42527-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v16-20020a05622a015000b0042a8900ba37si5623171qtw.311.2024.01.29.02.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 02:20:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42527-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; arc=pass (i=1 spf=pass spfdomain=xfusion.com); spf=pass (google.com: domain of linux-kernel+bounces-42527-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42527-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5C7181C20AB8 for ; Mon, 29 Jan 2024 10:20:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC6F857881; Mon, 29 Jan 2024 10:19:37 +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 07BB856474 for ; Mon, 29 Jan 2024 10:19:33 +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=1706523576; cv=none; b=b2A4vpFCIZnHSIM1W5tyJXmNbMCR79QxqBhqjQpVLGgkRo8m0DlUAg9xANwdz7NT4VM1iZTb1sTgI5WyER4ZqwadoDkmimOcaFOrDejB6Ek0ZvD+TXARtdyCgr13GlrRSLk29mfhOVY/AA6Co3CgOghw/J6dyhhKWW1otxzA5HQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706523576; c=relaxed/simple; bh=0pbNMZwQGIU61mp3Riq86bwoqCEQr3qg2nODWQqlvcU=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=GfhP1Kb/yqjzdDJ7Xjht7CoRJD009MG+VdiDA52R8kkvf+nO1Fcru1WEbe0ZRTQfCDpijYYkroDTWe5rbEGwZ/xXwDjYSDpfq6wbUgtwdkcg9yl6aYRMzGf2fNSKKQzoeLpkUzZjG1ZyACGxrAR9UMuNRSZ2oamRVqIpjfqYV/A= 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 4TNkmW1wQgzB0Y9C; Mon, 29 Jan 2024 18:19:07 +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:19:30 +0800 Date: Mon, 29 Jan 2024 18:19:29 +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: <202401291819+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: 1789419704134725117 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;