Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756170AbdGKRW2 (ORCPT ); Tue, 11 Jul 2017 13:22:28 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:49512 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755370AbdGKRW0 (ORCPT ); Tue, 11 Jul 2017 13:22:26 -0400 Date: Tue, 11 Jul 2017 13:22:04 -0400 From: Johannes Weiner To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, linux-mm@kvack.org, Alexander Duyck , Mel Gorman , Hao Lee , Vladimir Davydov , Joonsoo Kim , Michal Hocko , Tim Murray , Ingo Molnar , Steven Rostedt , stable@vger.kernel.org Subject: Re: [PATCH] tracing/ring_buffer: Try harder to allocate Message-ID: <20170711172204.GA961@cmpxchg.org> References: <20170711060500.17016-1-joelaf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170711060500.17016-1-joelaf@google.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1509 Lines: 32 On Mon, Jul 10, 2017 at 11:05:00PM -0700, Joel Fernandes wrote: > ftrace can fail to allocate per-CPU ring buffer on systems with a large > number of CPUs coupled while large amounts of cache happening in the > page cache. Currently the ring buffer allocation doesn't retry in the VM > implementation even if direct-reclaim made some progress but still > wasn't able to find a free page. On retrying I see that the allocations > almost always succeed. The retry doesn't happen because __GFP_NORETRY is > used in the tracer to prevent the case where we might OOM, however if we > drop __GFP_NORETRY, we risk destabilizing the system if OOM killer is > triggered. To prevent this situation, use the __GFP_RETRY_MAYFAIL flag > introduced recently [1]. > > Tested the following still succeeds without destabilizing a system with > 1GB memory. > echo 300000 > /sys/kernel/debug/tracing/buffer_size_kb > > [1] https://marc.info/?l=linux-mm&m=149820805124906&w=2 > > Cc: Alexander Duyck > Cc: Mel Gorman > Cc: Hao Lee > Cc: Vladimir Davydov > Cc: Johannes Weiner > Cc: Joonsoo Kim > Cc: Michal Hocko > Cc: Tim Murray > Cc: Ingo Molnar > Cc: Steven Rostedt > Cc: stable@vger.kernel.org > Signed-off-by: Joel Fernandes Acked-by: Johannes Weiner