From patchwork Mon Aug 14 15:08:07 2023 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: 135514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2828934vqi; Mon, 14 Aug 2023 08:44:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmyEGxg1J9BF1uWgBQPk4TUko2IT7O/KE6nJznsbJEtq+0ECWsqRA7G9jS59vnJrvNq3rG X-Received: by 2002:a05:6808:23cb:b0:3a1:db18:401e with SMTP id bq11-20020a05680823cb00b003a1db18401emr12254887oib.1.1692027842965; Mon, 14 Aug 2023 08:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692027842; cv=none; d=google.com; s=arc-20160816; b=E4XQAv2L4Wbk+wBXj7ZQ7NZeWeqcp1MpVxxHCqeyi22I+FDoHS/tqpxFnREwHkTb/K tAYSsTxobMdX7kDMhIbk4x1ghS5tiMxtTEpGYLfSUOW4LY8KsE8RQnXcpGtjarrwvnSW f7/EvkjEYb6GCjNSHJjncjzaYT5+2rfBwQP0VutBQ8t5W5lMWvHfN/JkLBnarGCoU2te DCgjlVnYn/kQwI5tpHpaqqxAe8AXQ+EZhejQ31HbqbtTazPW56eDpd8X9U5UxsZYZlQv SZp97FZl8UmdU+mFSrguRWBGFbLAl+/FtuB68OFOYcQaf4bR+oM78gnv2sVZArnPh2HV TpXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=pYuA2LAqTIp6HASyk3PwBvTsILwMa5dscav84Qp916o=; fh=ewCTnLrD3KzNr3Cj31i/vUzTH4c+xIppjr35abVBF0A=; b=QEXpn84jFrT1wvuUWhh+TemkwMpIftCHfp2CucZ4uF0uOevoiGuH5dVDnOpUGNmXH7 Jo6rggrZuUwjHGLqU5swwY5StGQcLeydWgDgUuTcnsBeouC+DAPjqT+N//i32cvipIX/ pOig+k6VrLSJt0DWYznZ2/QnrQSosrqt86F5irLkHbpbVUvVK+F0e1JyrAy9d1JCU8vd BysUyjCJF4xEIb0RpielY6IyGFix+zF8/U6BLA0BKULOJ9XsMP5WMFSYjTxrgCVXYd8e vtb+DDKUVm4tydJv1LQAL5IAD8qZebYFbXu+ZLmZOsCf6MHzSBiSc8I7cZp2Y2j9ki9u 8S+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YWAaSmQQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=gSzw455z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a656097000000b0056574d63583si6513721pgu.306.2023.08.14.08.43.45; Mon, 14 Aug 2023 08:44:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YWAaSmQQ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=gSzw455z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbjHNPIa (ORCPT + 99 others); Mon, 14 Aug 2023 11:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbjHNPIN (ORCPT ); Mon, 14 Aug 2023 11:08:13 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711BB1708; Mon, 14 Aug 2023 08:08:09 -0700 (PDT) Date: Mon, 14 Aug 2023 15:08:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692025688; 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=pYuA2LAqTIp6HASyk3PwBvTsILwMa5dscav84Qp916o=; b=YWAaSmQQaDsfXoAC7utF5142W2lkMKlMpGDN8nui+IYJoilU0ttbV0sRcgpgGS0zqPSPGd 1VasZOo/scO+L3xv43T/Hv4+Koswz9FaawroVdhBTbF2MhLy/aUhUORZ2UZ4nix3KNsCCB qhMHE4O5/44j2nju5CY73aQS/3By+1f7wIaAm0d0785Bqa7o2VFyt0DYsMetvHQNgjTnZi 1Zd991UChPXIbhinSoAhJ9KpRxz3BJeNdHYzX60iP6zBj5xGlslLmZuB0AJyOjw1ArWiTd lqeqExLxyTaX6canx5gSuWigzxlFadbtm9nvlVlIg2jv+y2teJPbzTQiCj/xZg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692025688; 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=pYuA2LAqTIp6HASyk3PwBvTsILwMa5dscav84Qp916o=; b=gSzw455zWBWzt//hBZln2EhSEjyqUG4INUm+QqFH6iOubcT0V3ja5bLtxyR56Rhjkaa43x VnVVjqWWiVmDzoAQ== From: "tip-bot2 for Cyril Hrubis" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset Cc: Cyril Hrubis , "Peter Zijlstra (Intel)" , Petr Vorel , Mel Gorman , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230802151906.25258-3-chrubis@suse.cz> References: <20230802151906.25258-3-chrubis@suse.cz> MIME-Version: 1.0 Message-ID: <169202568750.27769.3498187925487799057.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773137197557716115 X-GMAIL-MSGID: 1774219787566135642 The following commit has been merged into the sched/core branch of tip: Commit-ID: c1fc6484e1fb7cc2481d169bfef129a1b0676abe Gitweb: https://git.kernel.org/tip/c1fc6484e1fb7cc2481d169bfef129a1b0676abe Author: Cyril Hrubis AuthorDate: Wed, 02 Aug 2023 17:19:06 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 14 Aug 2023 17:01:23 +02:00 sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset The sched_rr_timeslice can be reset to default by writing value that is <= 0. However after reading from this file we always got the last value written, which is not useful at all. $ echo -1 > /proc/sys/kernel/sched_rr_timeslice_ms $ cat /proc/sys/kernel/sched_rr_timeslice_ms -1 Fix this by setting the variable that holds the sysctl file value to the jiffies_to_msecs(RR_TIMESLICE) in case that <= 0 value was written. Signed-off-by: Cyril Hrubis Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Petr Vorel Acked-by: Mel Gorman Tested-by: Petr Vorel Link: https://lore.kernel.org/r/20230802151906.25258-3-chrubis@suse.cz --- kernel/sched/rt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 185d3d7..0597ba0 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -3062,6 +3062,9 @@ static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, sched_rr_timeslice = sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE : msecs_to_jiffies(sysctl_sched_rr_timeslice); + + if (sysctl_sched_rr_timeslice <= 0) + sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE); } mutex_unlock(&mutex);