Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8010123rwp; Wed, 19 Jul 2023 04:02:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0o/UhwG51/DP7q1VJD7f58HnYwmJOHGKSgG2VoTELrUww35O7NSiRnNcnkZNp55p27TNW X-Received: by 2002:a2e:8519:0:b0:2b6:df15:f6b9 with SMTP id j25-20020a2e8519000000b002b6df15f6b9mr12481648lji.15.1689764562734; Wed, 19 Jul 2023 04:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689764562; cv=none; d=google.com; s=arc-20160816; b=OJH81Ja7OFrd+DsYNg5RQMBz3rNnART+p5vAhZxOy4eELSlwM506I7TBT2OtacS6H+ 8NpHvOO8rsbHXJW4C5l3EblPD03ydwforAODhv3pSLteP3E4e5bN9Xf7MUj3PoSeygyp sbGhgtfBSTckkgQ5kO4qAcoNfzrLZeqL2zC39mbTKp0frP06gDpbnpwU4DH9QIDE+mFQ vAfgsZRE4bbybnH2gtMn/DpuJ+742Fh+nevTi3KhC5K8k+RBGLPQ3XB+NTFbkHrQvMtQ mMqYMAt2pEoFzup+k2y7WuBUwqvlifNLYI4EDCF2bm9CgiM25lqJnaPH2xnFX4sVd3S/ NFMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=jeqTF0YThoc6mySM1WR7JjWXpTYufoMRK6i5Rw90wcY=; fh=6xZxXYcgwBDRlwE0Tg3Ps9BU0Ht3UcLLJSh2v6HK5AM=; b=klkjhidG84Wf4iDY2g4RlWHq/mwkn0WiHxLenCBJPUL0J6oeeTm5uh7LcDe/yX9VH1 CZXDn11DmebZU3M+MDLrYfhmk48wKB9Limy/Neu1psUYBjV7rOyw0T+oexCOICfnMSHZ xIftRH7dRWsKlaXXvsu6tZEcbjZE4alWU7hqX3JQhC5Zok/IlArdXFLRq9tqQ7xeOu2i cS9Zf2DOWuwoxhzTrpIdWPQghbidYwh90P/3efw+vw1DnaqFmcz6jKjJH9ag77HfwP07 DueVabpSnPJ+GWieH8TgsMpDr3pgqdKiXWlqSC7I3iMtaXcgJLbJyCiDP3irxdqal8k/ onhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=bHa6PSD8; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15-20020a17090635cf00b009920f18a5ebsi2798571ejb.729.2023.07.19.04.01.59; Wed, 19 Jul 2023 04:02:42 -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=@suse.cz header.s=susede2_rsa header.b=bHa6PSD8; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbjGSKg4 (ORCPT + 99 others); Wed, 19 Jul 2023 06:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbjGSKgw (ORCPT ); Wed, 19 Jul 2023 06:36:52 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6651FE5 for ; Wed, 19 Jul 2023 03:36:50 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 15DB121AE3; Wed, 19 Jul 2023 10:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1689763008; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jeqTF0YThoc6mySM1WR7JjWXpTYufoMRK6i5Rw90wcY=; b=bHa6PSD898Hbg0W0+FEy3dbxmyWtP3I+4oj79RWuCVxbm0Y8YnMTba9xTLZugZJ9HmsfQG 7JtFq4cb5TXn4nF3ArUzUyNW4ZYt/Y/dcTKjDCmlbpJrS0N9wLagkE3RBOnOVOP5VzQmIR 6/z3Hcel2zsGNTE6jVs0W2CoMXL3Utw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1689763008; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jeqTF0YThoc6mySM1WR7JjWXpTYufoMRK6i5Rw90wcY=; b=FeNscAHc/E6rXodGnW7Oa0a7sT88xE7n0hua9hqIbzros8Kwhmi5q6hL8esyvRiZgpzDRN cqERqVE1SXnyw+Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 01D331361C; Wed, 19 Jul 2023 10:36:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id d1+9Or+8t2RQRQAAMHmgww (envelope-from ); Wed, 19 Jul 2023 10:36:47 +0000 From: Cyril Hrubis To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org Cc: ltp@lists.linux.it, Cyril Hrubis , Jiri Bohac Subject: [PATCH 2/2] sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset Date: Wed, 19 Jul 2023 12:37:43 +0200 Message-ID: <20230719103743.4775-3-chrubis@suse.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719103743.4775-1-chrubis@suse.cz> References: <20230719103743.4775-1-chrubis@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 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 CC: Jiri Bohac --- kernel/sched/rt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 185d3d749f6b..0597ba0f85ff 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); -- 2.41.0