Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp430920lqd; Wed, 24 Apr 2024 06:51:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGAvoVWvyMXpbcJ3oLDfyIby4bkwAwz2qJZZNEawNsnq+w7BX91HDcSGaxIBdFbLyq344ZVPU7Z/r9uiz1EJ50pPOP2OW+ojePFA5t3g== X-Google-Smtp-Source: AGHT+IFa8KCwf24FZcCu+faHK9ch3tSp0pEdOWkPG0CwfaS2b3znnKteAdknNbSA50Xjt77suAC5 X-Received: by 2002:a05:6a20:9785:b0:1a7:5fe0:1c99 with SMTP id hx5-20020a056a20978500b001a75fe01c99mr2422481pzc.46.1713966703793; Wed, 24 Apr 2024 06:51:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713966703; cv=pass; d=google.com; s=arc-20160816; b=BA67jM9W53cSCVDEfvhj8yVyfMjqYL9/5z6z/+0jVi0rTkjfGzA6BADh57SYMhURJE WNf9+gpTDhTDQ6ct6X98aFRsd+MBcyZXn1t9l3zWM39yeZ1Dum6X9aJ3dQZ1D1SxwejM lrCDi4ePnuNFmu1aMKLmQheqRnEKB2tJ1ylhEVSFDkyHzDcyd0kTYVZlDUPBRBmB0Wqt JdtPTUJFDmfSnoopERIbLED3z3j6dK0EyLD8ywGrmcvrrTr7QK6uuBf8aYMdavM9mP+G spsKjTVijVAvIEmUZnf0X4icYqN5H5cVMd0UfFNxsjc07cKJEQE/anSd7az5mU8fYwP6 YkdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=lWDJorU1D944M1FSe6vSKTfEl9xG10jlkaY8WZR7ZN8=; fh=QaSxpqxPygAnyeetwFlK1wrmqRr3mrpboCicPB7DuSk=; b=iglNum+3lOUJtRIBnFFXjl/GIIwYWXRgRZrq4k8WEdxoPLzUH79jNMpSUBb8b1go9O MQsbMnkArrvGe/W1uPNDFHG2YLQ3LAxNplAFoJKM4XtIXMwSSNgzoyo7K92co6OMwu+m C5/FkdN8c9IECxc9d2rU+vj5GBivqjFFcJklILvoaaCV6NMTinwN5dbdnQvN326PHH/w Zz2qXicWeQOMdhStsRN8mtNs3WcseU11FDmayGmkpwcK1N2326wdOaVLo8XnxYYR/fcQ kpsiwi1irOJ5E25ErGFzi4ER2AuJpmN7VrYtXrKB7986cdpOye/ooRHT2HtzUIGRvIRc hDWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-156956-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156956-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z13-20020a637e0d000000b005f0a54b55fasi11670009pgc.817.2024.04.24.06.51.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 06:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156956-linux.lists.archive=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=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-156956-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156956-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 3AD20B238DE for ; Wed, 24 Apr 2024 13:29:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6E0E15CD42; Wed, 24 Apr 2024 13:29:40 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 4F3AB15A4B0 for ; Wed, 24 Apr 2024 13:29:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713965380; cv=none; b=XHY9nPbBb1ntQgq/8H9cytgwuoAhZOgiG9xd3cdkG/WsYqqh/ge3saqH/eVzvCI9jc9AC4UntZweeBm4TNyCX/jVBDflvT9CydWDcBn6L2WSvxVIq1322ypEU7opRSe/ck6Q3Ajt7b9kXweNKcv3ke7V0ra6kud/V2xiB34tH4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713965380; c=relaxed/simple; bh=YeGnNM3NBl2Yub3N76MBgc5Ql6v7CSjam7WnrDHtTxQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cJfZ36qGtmULqDSWufCYUutm2/LVkgVhvDC2vZbLO23LI68Xe6IaEXyC2aXEfNTh0rFln+e7lVJZvPiMY1NaxK0NkBLvWmBjFkDdJjTpsW1c4Bn1MKqJY4diWclaxZOTMbW9AjZqHB3+tZpxvXD4+ltKGSSp1qVKgF0wTXpaVjk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VPfs552B5zvPvj; Wed, 24 Apr 2024 21:26:33 +0800 (CST) Received: from kwepemf500005.china.huawei.com (unknown [7.202.181.243]) by mail.maildlp.com (Postfix) with ESMTPS id 6E58918006B; Wed, 24 Apr 2024 21:29:35 +0800 (CST) Received: from huawei.com (10.67.174.161) by kwepemf500005.china.huawei.com (7.202.181.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 24 Apr 2024 21:29:34 +0800 From: Cheng Yu To: , , , , , , , , , , , , , , CC: , , , Subject: [PATCH] sched/core: fix incorrect parameter burst in cpu_max_write() Date: Wed, 24 Apr 2024 21:24:38 +0800 Message-ID: <20240424132438.514720-1-serein.chengyu@huawei.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemf500005.china.huawei.com (7.202.181.243) In the cgroup v2 cpu subsystem, assuming we have a cgroup named test, we set cpu.max and cpu.max.burst: # echo 1000000 > /sys/fs/cgroup/test/cpu.max # echo 1000000 > /sys/fs/cgroup/test/cpu.max.burst then we check cpu.max and cpu.max.burst: # cat /sys/fs/cgroup/test/cpu.max 1000000 100000 # cat /sys/fs/cgroup/test/cpu.max.burst 1000000 Next we set cpu.max again and check cpu.max and cpu.max.burst: # echo 2000000 > /sys/fs/cgroup/test/cpu.max # cat /sys/fs/cgroup/test/cpu.max 2000000 100000 # cat /sys/fs/cgroup/test/cpu.max.burst 1000 we found that the cpu.max.burst value changed unexpectedly. In cpu_max_write(), the unit of the burst value returned by tg_get_cfs_burst() is microseconds, while in cpu_max_write(), the burst unit used for calculation should be nanoseconds, which leads to the bug. To fix it, we get the burst value directly from tg->cfs_bandwidth.burst. Reported-by: Qixin Liao Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller") Signed-off-by: Cheng Yu Signed-off-by: Zhang Qiao --- 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 7019a40457a6..d211d40a2edc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -11402,7 +11402,7 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of, { struct task_group *tg = css_tg(of_css(of)); u64 period = tg_get_cfs_period(tg); - u64 burst = tg_get_cfs_burst(tg); + u64 burst = tg->cfs_bandwidth.burst; u64 quota; int ret; -- 2.25.1