Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544984

Re: [PATCH] mm: throttle show_mem from warn_alloc

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: throttle show_mem from warn_alloc
Date Tue, 20 Dec 2016 09:40:02 +0100
Message-ID <sQo7M-3bu-5@gated-at.bofh.it> (permalink)
References <sOBiO-4xG-15@gated-at.bofh.it> <sQfxw-5WR-25@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gBnk6mI7to3CuxiMK+DU9kWcRPfM+h/Iy1535tW7N1A=; b=V4shp6KQcTsloWtbiAxtMEHWwoqd2yngPll5RfJ/cPlbgohwHVse2YlNNjPDRAVuqX evS1bhQ7qePs9lJgpe8+msqnheKBU2WToYOMJbqxGulS29cpn1DMDYGNndlyFbf7VgM/ IQAtBgtuIR5shg4Tyog025i62UE2/N2c8LNhzYF8vb/jlfrvi6YMWgVAw70fJ34q8gmq 7WqMtiNzk2hVVfBczUrNiqSEGj94HbdtucrDK7rWeg1hzHKLhG2di4+ZC4CbyA4rZne7 IT2ts7Sf2+nXPnXz1Z5Rp1dnDrq12yDL6CMgd3+V9imXHfdGjI/MxElDF8cXS2OrA6Gi NPXQ==
X-Gm-Message-State AIkVDXJQykhMcQ3/3UBsSOPFdAJ8MqS8ofpQjgr2AMGy3fxSHPluUMrNac4cLoAuzm04/g==
X-Received by 10.28.142.5 with SMTP id q5mr804024wmd.78.1482222939499; Tue, 20 Dec 2016 00:35:39 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.6.0 (2016-04-01)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 61
Organization linux.* mail to news gateway
X-Original-Cc Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>, linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
X-Original-Date Tue, 20 Dec 2016 09:35:38 +0100
X-Original-Message-ID <20161220083537.GA3769@dhcp22.suse.cz>
X-Original-References <20161215101510.9030-1-mhocko@kernel.org> <20161219152125.f77ddf79f3c89e5cdd0e02d6@linux-foundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1544984

Show key headers only | View raw


On Mon 19-12-16 15:21:25, Andrew Morton wrote:
> On Thu, 15 Dec 2016 11:15:10 +0100 Michal Hocko <mhocko@kernel.org> wrote:
> 
> > Tetsuo has been stressing OOM killer path with many parallel allocation
> > requests when he has noticed that it is not all that hard to swamp
> > kernel logs with warn_alloc messages caused by allocation stalls. Even
> > though the allocation stall message is triggered only once in 10s there
> > might be many different tasks hitting it roughly around the same time.
> > 
> > A big part of the output is show_mem() which can generate a lot of
> > output even on a small machines. There is no reason to show the state of
> > memory counter for each allocation stall, especially when multiple of
> > them are reported in a short time period. Chances are that not much has
> > changed since the last report. This patch simply rate limits show_mem
> > called from warn_alloc to only dump something once per second. This
> > should be enough to give us a clue why an allocation might be stalling
> > while burst of warnings will not swamp log with too much data.
> > 
> > While we are at it, extract all the show_mem related handling (filters)
> > into a separate function warn_alloc_show_mem. This will make the code
> > cleaner and as a bonus point we can distinguish which part of warn_alloc
> > got throttled due to rate limiting as ___ratelimit dumps the caller.
> 
> These guys don't need file-wide scope...
> 
> --- a/mm/page_alloc.c~mm-throttle-show_mem-from-warn_alloc-fix
> +++ a/mm/page_alloc.c
> @@ -3018,15 +3018,10 @@ static inline bool should_suppress_show_
>  	return ret;
>  }
>  
> -static DEFINE_RATELIMIT_STATE(nopage_rs,
> -		DEFAULT_RATELIMIT_INTERVAL,
> -		DEFAULT_RATELIMIT_BURST);
> -
> -static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);
> -
>  static void warn_alloc_show_mem(gfp_t gfp_mask)
>  {
>  	unsigned int filter = SHOW_MEM_FILTER_NODES;
> +	static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);
>  
>  	if (should_suppress_show_mem() || !__ratelimit(&show_mem_rs))
>  		return;
> @@ -3050,6 +3045,8 @@ void warn_alloc(gfp_t gfp_mask, const ch
>  {
>  	struct va_format vaf;
>  	va_list args;
> +	static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
> +				      DEFAULT_RATELIMIT_BURST);
>  
>  	if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) ||
>  	    debug_guardpage_minorder() > 0)
> _
> 

Acked-by: Michal Hocko <mhocko@suse.com>

-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm: throttle show_mem from warn_alloc Michal Hocko <mhocko@kernel.org> - 2016-12-15 11:20 +0100
  Re: [PATCH] mm: throttle show_mem from warn_alloc Andrew Morton <akpm@linux-foundation.org> - 2016-12-20 00:30 +0100
    Re: [PATCH] mm: throttle show_mem from warn_alloc Michal Hocko <mhocko@kernel.org> - 2016-12-20 09:40 +0100

csiph-web