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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 44AD6C433E7 for ; Tue, 13 Oct 2020 09:03:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 812D220E65 for ; Tue, 13 Oct 2020 09:03:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="mdwLR0IO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 812D220E65 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 8BBD2940007; Tue, 13 Oct 2020 05:03:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86E42900002; Tue, 13 Oct 2020 05:03:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 782DC940007; Tue, 13 Oct 2020 05:03:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 49EE3900002 for ; Tue, 13 Oct 2020 05:03:03 -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 BEE818249980 for ; Tue, 13 Oct 2020 09:03:02 +0000 (UTC) X-FDA: 77366312604.23.quiet51_611358e27201 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 9BFEC37606 for ; Tue, 13 Oct 2020 09:03:02 +0000 (UTC) X-HE-Tag: quiet51_611358e27201 X-Filterd-Recvd-Size: 4607 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 13 Oct 2020 09:03:02 +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=1602579780; 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: in-reply-to:in-reply-to:references:references; bh=DbKGDqjlwlakbxgdS48ayFBs6rynQZgAtYyxzEgTdRo=; b=mdwLR0IOGcSio/sKtYKJeSdmEmLS8ppxB/S44+6yNd3e7tvfXVEacDC4EC43+bcLpx6aLB 0ALkN7KOsjBzY6cXZ60wN/fr7zf5ggUOQSuO82AD+XRfRFmA0zSD8UJtQyXhH9eU7zt1ac 4gLRihI+b9NHmwOTDA7FGt3cfGlVBTY= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 92AC9AFD2; Tue, 13 Oct 2020 09:03:00 +0000 (UTC) Date: Tue, 13 Oct 2020 11:02:59 +0200 From: Petr Mladek To: Tetsuo Handa Cc: Ricardo =?iso-8859-1?Q?Ca=F1uelo?= , Michal Hocko , akpm@linux-foundation.org, 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, Sergey Senozhatsky , Steven Rostedt Subject: Re: [PATCH] mm, oom: enable rate-limiting controls for oom dumps Message-ID: <20201013090259.GC26155@alley> References: <20201009093014.9412-1-ricardo.canuelo@collabora.com> <20201012152232.GD10602@alley> <20201012154114.GJ29725@dhcp22.suse.cz> <87993bef-3f83-0527-fa52-4f2c28eb7e56@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87993bef-3f83-0527-fa52-4f2c28eb7e56@i-love.sakura.ne.jp> 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: On Tue 2020-10-13 09:40:27, Tetsuo Handa wrote: > On 2020/10/13 0:41, Michal Hocko wrote: > >> 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 = 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 am pretty sure this has been discussed in the past but maybe we really > > want to make ratelimit to work reasonably also for larger sections > > instead. Current implementation only really works if the rate limited > > operation is negligible wrt to the interval. Can we have a ratelimit > > alternative with a scope effect (effectivelly lock like semantic)? > > if (rate_limit_begin(&oom_rs)) { > > dump_header(); > > rate_limit_end(&oom_rs); > > } > > > > rate_limi_begin would act like a try lock with additional constrain on > > the period/cadence based on rate_limi_end marked values. > > > > Here is one of past discussions. > > https://lkml.kernel.org/r/7de2310d-afbd-e616-e83a-d75103b986c6@i-love.sakura.ne.jp > https://lkml.kernel.org/r/20190830103504.GA28313@dhcp22.suse.cz > https://lkml.kernel.org/r/57be50b2-a97a-e559-e4bd-10d923895f83@i-love.sakura.ne.jp > > Michal Hocko complained about different OOM domains, and now just ignores it... How is this related to this discussion, please? AFAIK, we are discussing how to tune the values of the existing ratelimiting. > Proper ratelimiting for OOM messages had better not to count on asynchronous printk(). I am a bit confused. AFAIK, you wanted to print OOM messages asynchronous ways in the past. The lockless printk ringbuffer is on its way into 5.10. Handling consoles in kthreads will be the next step of the printk rework. OK, the current state is that printk() is semi-synchronous. It does console_trylock(). The console is handled immediately when it succeeds. Otherwise it expects that the current console_lock owner would do the job. Tuning ratelimits is not trivial for a particular system. It would be better to have some autotuning. If the printk is synchronous, we could measure how long the printing took. If it is asynchronous, we could check whether the last report has been already flushed or not. We could then decide whether to print the new report. What is the desired behavior, please? Could you please provide some examples how you would tune ratelimit when printing all messages to the console takes X ms and OOM happens every Y ms? Best Regards, Petr