From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.9]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3C7F191F95 for ; Mon, 20 Jan 2025 11:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737373505; cv=none; b=jNLyXI4yreHE8T+r+/GqJ6WG+n604K5ExNWZ1mxGL0XMMc9nSol6CIDx1lf+VUMF01Ns25PYGfZtUts1ICsgRQKJkj6W1Wa5nSQV8kGiFwZgYjMdWP21NHNIttqb/eDM5coRObjkujC/CRVefQt5WwUtMab8mtaqKXBHeo3MYcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737373505; c=relaxed/simple; bh=60Fcj8mWU3eqyuARWhcQbG1HalXZy9ARt96uE6wce4M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IyciH/PKBAJ2aQzq0Jom+TvYFJrnRBsKgVvh1eSCLRYEnrHF6F49Se+NDlqZGHTHF2LhSqucIaq7hHtIa7JIPo2uX87oz46brMrmdPGl1uP6mZ2VGRFrEO+qiR16Q1dz157OEIA/1bTkUeI13ZhJh15APZmR4JPhLPegKd04VMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=qJr2Fjkd; arc=none smtp.client-ip=117.135.210.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="qJr2Fjkd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:From: Content-Type; bh=uMdgkeHRoWWDne7b/U/doykacoeBHC5c8UiPlhBq5TE=; b=qJr2FjkdbNcsUp8ZgNnyS8ES5bJxumsI9u7PxJbd3roHyIFSbOXK1BvWwcw0Nf GNaEDh1zk2XfYRsNmROOYpI+zM6CVyQLEqCSSUE9pJHZVh4sEDtmKXrUBwHwoVlu 3F6BUdCnbHm1WgFt99tzd1qTCcMZe3mq1OtnHBBPhl4mo= Received: from [172.24.148.79] (unknown []) by gzga-smtp-mtada-g1-1 (Coremail) with SMTP id _____wD3XwuUNo5ncQ_nBQ--.29195S2; Mon, 20 Jan 2025 19:42:14 +0800 (CST) Message-ID: <831bd791-8602-41da-9cc3-a44d91010cfb@126.com> Date: Mon, 20 Jan 2025 19:42:12 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2] sched: Forward deadline for early tick To: zihan zhou <15645113830zzh@gmail.com>, vincent.guittot@linaro.org Cc: bsegall@google.com, dietmar.eggemann@arm.com, juri.lelli@redhat.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, vschneid@redhat.com, yaowenchao@jd.com, yaozhenguo@jd.com References: <20250120073857.47043-1-15645113830zzh@gmail.com> Content-Language: en-US From: Honglei Wang In-Reply-To: <20250120073857.47043-1-15645113830zzh@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID:_____wD3XwuUNo5ncQ_nBQ--.29195S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGw1fJF48AFyrJw1DXw13urg_yoW5Xr1rpF Z8AF1xuwn5J3WxtayxZF4xZa409r1xJry3XF4qqr1kArn0gr1fKF4xKa45uFWxXrySkF42 vF42g343t3WqvFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UtpnQUUUUU= X-CM-SenderInfo: 5mdpv2pkrqwzphlzt0bj6rjloofrz/1tbiJB7arWeOJJOb+wAAsz Hi Zihan, On 2025/1/20 15:38, zihan zhou wrote: > Thanks for your reply! > >> For sure we should provide recommendation but I'm not sure it's worth >> a warning but better a documentation for user who wants to set their >> slice > >> Could you create a patch that only updates sysctl_sched_base_slice >> and normalized_sysctl_sched_base_slice to 700000UL with figures and >> explanation > > Thank you for your suggestion! Adding a warning is not worth it. I will > submit a new patch soon, which changes the default value of slice > and add the code comments about this change. I am not sure if I > should change the files in the Documentation directory. If I should, > I will move the content in the comments to the Documentation directory. > >> sysctl_sched_base_slice is updated by update_sysctl() for each cpu >> hotplug so you can't really set it directly >> >> You can then try a 2nd patch which updates it with debugfs but I'm not >> convince at all by this benefit because it should update the >> normalized_sysctl_sched_base_slice which is really meaningless for >> user > > There is indeed a big problem with this, and I overlooked it. Thank you > for your corrections. I actually intended to add a numerical range > requirement to slice through sched_base_slice_fops, because I noticed that > syscalls has a range requirement (NSEC_PER_MSEC/10, NSEC_PER_MSEC*100) > for modifying slice. However, it seems that the existence of this range is > not important. > >>> diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c >>> index ff0e5ab4e37c..d0f90d61398f 100644 >>> --- a/kernel/sched/syscalls.c >>> +++ b/kernel/sched/syscalls.c >>> @@ -309,6 +309,10 @@ static void __setscheduler_params(struct task_struct *p, >>> p->se.slice = clamp_t(u64, attr->sched_runtime, >>> NSEC_PER_MSEC/10, /* HZ=1000 * 10 */ >>> NSEC_PER_MSEC*100); /* HZ=100 / 10 */ >>> + >>> + if (p->se.slice % TICK_NSEC == 0) >>> + pr_warn("It is not recommended to set the slice to an integer multiple of the tick\n"); >> >> You should better add documentation than a warning >> >> Also, this code has moved in fair.c now > > I'm a bit confused here. Has this code been moved from syscalls.c to > fair.c file? I haven't seen this change on the master kernel. > Is there any other code repository? > Just FYI. I think Vincent meant this one 2cf9ac40073d ("sched/fair: Encapsulate set custom slice in a __setparam_fair() function"). You can check it at the sched/core branch here: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=sched/core&id=2cf9ac40073ddb6a70dd5ef94f1cf45501b696ed Thanks, Honglei