Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6357086ybi; Mon, 8 Jul 2019 01:44:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxj0zjjKt0cxwGX/ZJz5a6qxAkf0ILBYGknlp8k+cU225YFA42IN7JaM5DaeX7QmLimCBFJ X-Received: by 2002:a65:504c:: with SMTP id k12mr22223054pgo.252.1562575488841; Mon, 08 Jul 2019 01:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562575488; cv=none; d=google.com; s=arc-20160816; b=d2IbfcNRlJuenKjSqJsS2tOoiuSjo4DY/UC/qN4Z2XmDO+rt3szhaX4rmyprjH89FO 9jE3omDfi04Lhw7464JDGFKBsJGuFlSyWK74pmjmMcoMAWSA8gI5QS1OkJ58cE/qWnIW OW9OuELvQrHTAvRCFHBDbavFUFqbUaMoy+WKRJxhWdDbM4fM+VbkMwqi1FFgq81ZSO8e IX8szYvDIFa1Fz0Zaw+HIcq8EN844r9gvqmEsN66AyBoJtVCg9FxUsDdaR/reKbioBkJ 3vKSzy1UXTYrubgjykDPxHDPDy4WNKE8jduHKzyNfd10TFI9pkw7X5HN73XUxHKnX+9J CwHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=SqZms596Oi7Cj5F0CDlxXcdKnJlNu1P9OhPHXuzZa7M=; b=Qr0J7CA8XtGAFQdWQu2BjDm3CX+SZa7B8wiqDyUnv8q4CIodzOuGhsnARwWJTRpWDp tVQKOMNMSS9IylB902Mwk8xJyjiFjvQfHqYr51dz3PF8Ws+PvOZTnS9g+ojdI5+EsvuJ ZR2tpaKDc7SoWVtzuSAVR6e7YEACGWxMwCmlrRWs6HSKbhfBlJtYWjEy1VkjuqJDem8o A9c6edcyAzaaytN7RDyHbm3d4wXnk5u8I9JIoHuneFVykEWQe6fmUmjZ5o6hfAhp/xeV 0fyvW0IBYnPdQI5WfdQCaOpM+BTkAmbDb8eyg1YhzQQ6f5+pKKnz+DRc3o7QjucYZaSG W/oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si15573772pjs.3.2019.07.08.01.44.34; Mon, 08 Jul 2019 01:44:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728870AbfGHGBD (ORCPT + 99 others); Mon, 8 Jul 2019 02:01:03 -0400 Received: from lgeamrelo11.lge.com ([156.147.23.51]:37352 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728075AbfGHGBD (ORCPT ); Mon, 8 Jul 2019 02:01:03 -0400 Received: from unknown (HELO lgeamrelo02.lge.com) (156.147.1.126) by 156.147.23.51 with ESMTP; 8 Jul 2019 15:01:01 +0900 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.222.33) by 156.147.1.126 with ESMTP; 8 Jul 2019 15:01:01 +0900 X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: paulmck@linux.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@lge.com Subject: [PATCH] rcu: Make jiffies_till_sched_qs writable Date: Mon, 8 Jul 2019 15:00:09 +0900 Message-Id: <1562565609-12482-1-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org jiffies_till_sched_qs is useless if it's readonly as it is used to set jiffies_to_sched_qs with its value regardless of first/next fqs jiffies. And it should be applied immediately on change through sysfs. The function for setting jiffies_to_sched_qs, adjust_jiffies_till_sched_qs() will be called only if the value from sysfs != ULONG_MAX. And the value won't be adjusted unlike first/next fqs jiffies. While at it, changed the positions of two module_param()s downward. Signed-off-by: Byungchul Park --- kernel/rcu/tree.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index a2f8ba2..a28e2fe 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -422,9 +422,7 @@ static int rcu_is_cpu_rrupt_from_idle(void) * quiescent-state help from rcu_note_context_switch(). */ static ulong jiffies_till_sched_qs = ULONG_MAX; -module_param(jiffies_till_sched_qs, ulong, 0444); static ulong jiffies_to_sched_qs; /* See adjust_jiffies_till_sched_qs(). */ -module_param(jiffies_to_sched_qs, ulong, 0444); /* Display only! */ /* * Make sure that we give the grace-period kthread time to detect any @@ -450,6 +448,18 @@ static void adjust_jiffies_till_sched_qs(void) WRITE_ONCE(jiffies_to_sched_qs, j); } +static int param_set_sched_qs_jiffies(const char *val, const struct kernel_param *kp) +{ + ulong j; + int ret = kstrtoul(val, 0, &j); + + if (!ret && j != ULONG_MAX) { + WRITE_ONCE(*(ulong *)kp->arg, j); + adjust_jiffies_till_sched_qs(); + } + return ret; +} + static int param_set_first_fqs_jiffies(const char *val, const struct kernel_param *kp) { ulong j; @@ -474,6 +484,11 @@ static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param return ret; } +static struct kernel_param_ops sched_qs_jiffies_ops = { + .set = param_set_sched_qs_jiffies, + .get = param_get_ulong, +}; + static struct kernel_param_ops first_fqs_jiffies_ops = { .set = param_set_first_fqs_jiffies, .get = param_get_ulong, @@ -484,8 +499,11 @@ static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param .get = param_get_ulong, }; +module_param_cb(jiffies_till_sched_qs, &sched_qs_jiffies_ops, &jiffies_till_sched_qs, 0644); module_param_cb(jiffies_till_first_fqs, &first_fqs_jiffies_ops, &jiffies_till_first_fqs, 0644); module_param_cb(jiffies_till_next_fqs, &next_fqs_jiffies_ops, &jiffies_till_next_fqs, 0644); + +module_param(jiffies_to_sched_qs, ulong, 0444); /* Display only! */ module_param(rcu_kick_kthreads, bool, 0644); static void force_qs_rnp(int (*f)(struct rcu_data *rdp)); -- 1.9.1