From patchwork Tue Oct 30 16:27:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 12589 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 89E1F23EF7 for ; Tue, 30 Oct 2012 16:40:38 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1E993A18F3F for ; Tue, 30 Oct 2012 16:40:38 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so673409iej.11 for ; Tue, 30 Oct 2012 09:40:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=z6t4lck+sJvSAJsaW/h/AzShiWwnyUBXUQp+V8ZVbDE=; b=RK8h6LDcCpCLi6LD0Myg8WOoXEt+QKfByQeGXilj3AuqvzQtRUV1Q1ODo2MbaRqUV2 J+Zk+5BqyS9zB3OVvT4NORC7G6jhM5BW3JB3iGHs4p+DYVgW6WVa9UHujZ0ogLtXPFcC Y6qdOXhfqsgr6zyi0KutuIEnJKbpWYYjNtOo+lVRYyT012JF6Z3lWolhnOZi8orWUEas QrvQm/MBBkzFKbcYyc1X+WiS9e0KamOPTeS4Fe7NGoNsqLieznxrahcLhsuQt5Nsuz3z uo294mKo46lfbt7SRQ6yzugqGQ+uRp2R7nQYDRyAnbhE6/qjbmP43MM8BmHydm6E0BAv 1bvw== Received: by 10.42.21.68 with SMTP id j4mr10558034icb.18.1351615237498; Tue, 30 Oct 2012 09:40:37 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp446943igt; Tue, 30 Oct 2012 09:40:37 -0700 (PDT) Received: by 10.50.173.101 with SMTP id bj5mr2077945igc.42.1351615237126; Tue, 30 Oct 2012 09:40:37 -0700 (PDT) Received: from e7.ny.us.ibm.com (e7.ny.us.ibm.com. [32.97.182.137]) by mx.google.com with ESMTPS id ak4si1196420icc.76.2012.10.30.09.40.36 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 09:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.137 as permitted sender) client-ip=32.97.182.137; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.137 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Oct 2012 12:40:36 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Oct 2012 12:40:14 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 5CF00C9004A; Tue, 30 Oct 2012 12:40:13 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9UGeCUx299204; Tue, 30 Oct 2012 12:40:12 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9UGd9mI010758; Tue, 30 Oct 2012 10:39:10 -0600 Received: from paulmck-ThinkPad-W500 (sig-9-65-77-17.mts.ibm.com [9.65.77.17]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9UGd7HR010422; Tue, 30 Oct 2012 10:39:08 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 00402E4D59; Tue, 30 Oct 2012 09:27:56 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" , "Paul E. McKenney" Subject: [PATCH tip/core/rcu 2/6] rcu: Fix batch-limit size problem Date: Tue, 30 Oct 2012 09:27:51 -0700 Message-Id: <1351614475-22895-2-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1351614475-22895-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20121030162728.GA22648@linux.vnet.ibm.com> <1351614475-22895-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12103016-5806-0000-0000-00001B3449A5 X-Gm-Message-State: ALoCoQlArh+L/KXFS0pMIGAZ4oGWNl1Zo0rWcUjwDrnpLO3+hoKf6/c3gq/EoVsMCXyLV6tFuehU From: "Paul E. McKenney" Commit 29c00b4a1d9e27 (rcu: Add event-tracing for RCU callback invocation) added a regression in rcu_do_batch() Under stress, RCU is supposed to allow to process all items in queue, instead of a batch of 10 items (blimit), but an integer overflow makes the effective limit being 1. So, unless there is frequent idle periods (during which RCU ignores batch limits), RCU can be forced into a state where it cannot keep up with the callback-generation rate, eventually resulting in OOM. This commit therefore converts a few variables in rcu_do_batch() from int to long to fix this problem, along with the module parameters controlling the batch limits. Signed-off-by: Eric Dumazet Signed-off-by: Paul E. McKenney Cc: # 3.2 + --- kernel/rcutree.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 93d6871..e4c2192 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -212,13 +212,13 @@ DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = { #endif }; -static int blimit = 10; /* Maximum callbacks per rcu_do_batch. */ -static int qhimark = 10000; /* If this many pending, ignore blimit. */ -static int qlowmark = 100; /* Once only this many pending, use blimit. */ +static long blimit = 10; /* Maximum callbacks per rcu_do_batch. */ +static long qhimark = 10000; /* If this many pending, ignore blimit. */ +static long qlowmark = 100; /* Once only this many pending, use blimit. */ -module_param(blimit, int, 0444); -module_param(qhimark, int, 0444); -module_param(qlowmark, int, 0444); +module_param(blimit, long, 0444); +module_param(qhimark, long, 0444); +module_param(qlowmark, long, 0444); int rcu_cpu_stall_suppress __read_mostly; /* 1 = suppress stall warnings. */ int rcu_cpu_stall_timeout __read_mostly = CONFIG_RCU_CPU_STALL_TIMEOUT; @@ -1791,7 +1791,8 @@ static void rcu_do_batch(struct rcu_state *rsp, struct rcu_data *rdp) { unsigned long flags; struct rcu_head *next, *list, **tail; - int bl, count, count_lazy, i; + long bl, count, count_lazy; + int i; /* If no callbacks are ready, just return.*/ if (!cpu_has_callbacks_ready_to_invoke(rdp)) {