From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9F64C43457 for ; Mon, 12 Oct 2020 15:22:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B4F820878 for ; Mon, 12 Oct 2020 15:22:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.com header.i=@suse.com header.b="B4JR8W74" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B4F820878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CE2806B0068; Mon, 12 Oct 2020 11:22:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6AEA6B006C; Mon, 12 Oct 2020 11:22:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B33FB6B006E; Mon, 12 Oct 2020 11:22:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7D79A6B0068 for ; Mon, 12 Oct 2020 11:22:35 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1B7D5824999B for ; Mon, 12 Oct 2020 15:22:35 +0000 (UTC) X-FDA: 77363640270.23.nest06_23128fa271fb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id E4B7B37606 for ; Mon, 12 Oct 2020 15:22:34 +0000 (UTC) X-HE-Tag: nest06_23128fa271fb X-Filterd-Recvd-Size: 5538 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Mon, 12 Oct 2020 15:22:34 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1602516153; h=from:from: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; bh=SMgxplyX48HwA09LKvLIpC86v9g/09IYAlEMnPu+/kI=; b=B4JR8W74kx99luw4/yeuNGJWKmRP9dmyMhbgVYGE2YjXk7LWspArgM4Xfw4J7INaQ9zawS qIbDiKkrx0hOyvDtCxNkn9lGoUPNME6ZkEoAILoIezLnwhwCY0mLiXeInnyjXRdp04D3jy ZI/cQZPIMuJlhtGFz88EsDQc9ijmDLk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2A456B2DA; Mon, 12 Oct 2020 15:22:33 +0000 (UTC) Date: Mon, 12 Oct 2020 17:22:32 +0200 From: Petr Mladek To: Ricardo =?iso-8859-1?Q?Ca=F1uelo?= , akpm@linux-foundation.org Cc: kernel@collabora.com, hch@lst.de, guro@fb.com, rientjes@google.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, linux-mm@kvack.org, mhocko@suse.cz, Sergey Senozhatsky , Steven Rostedt Subject: Re: [PATCH] mm, oom: enable rate-limiting controls for oom dumps Message-ID: <20201012152232.GD10602@alley> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20201009093014.9412-1-ricardo.canuelo@collabora.com> Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > Add two sysctl entries (vm.oom_dump_ratelimit and > vm.oom_dump_ratelimit_burst) to control the rate limiting interval and > burst, respectively, of the OOM killer output (oom_kill_process()). >=20 > These entries are disabled by default and can be enabled during kernel > configuration with CONFIG_DUMP_RATELIMIT. They take > DEFAULT_RATELIMIT_INTERVAL and DEFAULT_RATELIMIT_BURST as their default > values. >=20 > Signed-off-by: Ricardo Ca=F1uelo > --- >=20 > In some setups, the amount of output that the OOM killer generates when > it kills a process and dumps the list of tasks can be too > large. Unfortunately, the rate-limiting used for it uses the default > values for the rate limit interval and burst. This patch allows the use= r > to configure these values. It might be pretty hard to set any reasonable values. It depends on the console speed and the amount of processes on the system. I wonder who many people would be able to use it in reality. What about introducing some feedback from the printk code? static u64 printk_last_report_seq; if (consoles_seen(printk_last_report_seq)) { dump_header(); printk_last_report_seq =3D printk_get_last_seq(); } By other words. It would skip the massive report when the consoles were not able to see the previous one. > I created a new menu selection inside "printk and dmesg options" for > this option. Many other parts of the kernel use either hardcoded or > default values for the rate limiting parameters. If, in the future, mor= e > of these cases need to be parameterized, this new submenu can be used t= o > hold any new config option related to rate limiting. >=20 > include/linux/oom.h | 2 ++ > kernel/sysctl.c | 16 ++++++++++++++++ > lib/Kconfig.debug | 13 +++++++++++++ > mm/oom_kill.c | 5 +++++ > 4 files changed, 36 insertions(+) >=20 > diff --git a/include/linux/oom.h b/include/linux/oom.h > index 2db9a1432511..76c560a1a4c7 100644 > --- a/include/linux/oom.h > +++ b/include/linux/oom.h > @@ -127,4 +127,6 @@ extern struct task_struct *find_lock_task_mm(struct= task_struct *p); > extern int sysctl_oom_dump_tasks; > extern int sysctl_oom_kill_allocating_task; > extern int sysctl_panic_on_oom; > +extern int sysctl_oom_dump_ratelimit; > +extern int sysctl_oom_dump_ratelimit_burst; > #endif /* _INCLUDE_LINUX_OOM_H */ > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index ce75c67572b9..d348eac7e561 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -2708,6 +2708,22 @@ static struct ctl_table vm_table[] =3D { > .mode =3D 0644, > .proc_handler =3D proc_dointvec, > }, > +#ifdef CONFIG_OOM_DUMP_RATELIMIT I do not see a reason to have this build configurable. The options are either useful or not. > + { > + .procname =3D "oom_dump_ratelimit", > + .data =3D &sysctl_oom_dump_ratelimit, > + .maxlen =3D sizeof(sysctl_oom_dump_ratelimit), > + .mode =3D 0644, > + .proc_handler =3D proc_dointvec, > + }, > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -54,6 +54,8 @@ > int sysctl_panic_on_oom; > int sysctl_oom_kill_allocating_task; > int sysctl_oom_dump_tasks =3D 1; > +int sysctl_oom_dump_ratelimit =3D DEFAULT_RATELIMIT_INTERVAL; > +int sysctl_oom_dump_ratelimit_burst =3D DEFAULT_RATELIMIT_BURST; > =20 > /* > * Serializes oom killer invocations (out_of_memory()) from all contex= ts to > @@ -959,6 +961,9 @@ static void oom_kill_process(struct oom_control *oc= , const char *message) > static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, > DEFAULT_RATELIMIT_BURST); > =20 > + oom_rs.interval =3D sysctl_oom_dump_ratelimit; > + oom_rs.burst =3D sysctl_oom_dump_ratelimit_burst; Why is _interval suffix omitted in the first variable? I find this pretty confusing. Best Regards, Petr