Received: by 10.213.65.68 with SMTP id h4csp898807imn; Wed, 4 Apr 2018 09:05:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+bKNps0MCjA6nw5T/rGkQYykJxn09xOp3OQBIndQDzKBJUF906Nrp/yAfSI4W4UJeQRleA X-Received: by 2002:a17:902:ab98:: with SMTP id f24-v6mr18848487plr.331.1522857928647; Wed, 04 Apr 2018 09:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522857928; cv=none; d=google.com; s=arc-20160816; b=h7CMWAZ0ON8bTsl1bScDJWxBIaTb0Za5dKfYXeN1i0ynjN8t8B1fd4hUCOqQ08wADT j37+q/CQibK0vgHNbR2WtX/qnjvG2f6zeYP1TphLmgC5FO4XELoiYZnubQefHEdRoF2F y7KNTVBmEDjEC3jrt1tSR8yZiVPsOQvyz+Tdx+Lrjjco/VbKJTAUaPO0dBEyaIGoFyye dI55CT/PsWFKK9Qv0zbb942U7jybyOJ4FHGFcmo2apOGEebHFRGbYMbSvHYRn2dW0/wv rNo7CeAUQXRPFByy0Si71rB30r24u80eibeeqiWH+cnBM6Mhf6Tn4oZIjwxb52mHToCK Sb0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=mD/ecWR+ZPrc+Vn69RUwS/sk/5bYSuo4wAU0dFePbbc=; b=iy1viDqzlwgNZrWV//IEk+u1goKjdhWoe8LcIrB3xngsrid6hrODXVFQIpY+F2wAMN JtCGpD6LlGULq+lb7FVJF6lT/u+aHXepBfLggWG0oJU7MgE43Rc7gRkV8/VbuKKPRj+d PlH1TDnspJQ31Y4hDqiD+k0+S2tShqz0GuQsfS/hcF4mtG/d5Hd87B3nkAPnTr7kiXCa SiQQrB8Z+iQAwh9PIS29dp6LakYns5b2P5wMi0+mweKy2r6wJq12bAb5JXIjMjdUyWNj zVN3GfiKRwXePboQXSGRJqU3arzcuLxyl1tKLOdIdyxPstUNL+bx9choJGE6ITzMjibT T3fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JOvouAH5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si3948188pgq.478.2018.04.04.09.05.14; Wed, 04 Apr 2018 09:05:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JOvouAH5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752303AbeDDQDw (ORCPT + 99 others); Wed, 4 Apr 2018 12:03:52 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:40408 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049AbeDDQDt (ORCPT ); Wed, 4 Apr 2018 12:03:49 -0400 Received: by mail-it0-f67.google.com with SMTP id u62-v6so17407230ita.5 for ; Wed, 04 Apr 2018 09:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mD/ecWR+ZPrc+Vn69RUwS/sk/5bYSuo4wAU0dFePbbc=; b=JOvouAH50qHduSQDG0L069+x8IyMBe/m9Xq7MvLds7KiwuCPNdDsjmp6RJYA9y/qEX AqaigyaPijaA9HVnmYCTJcK4oPaYtueXI+8415HwPDlQS96QFIUBOQN8xOwiNisiB58q E6e/Z784b+Gtcwg3EVmYAfANvZNrNie08Pdk9ewVXMSjeuvWW6k22psLA/tZvbsOlC00 o27DrZV/EHfl159TnKJ7AjdgHZ+uvbaPdUTPdPALB+6nLh6GcO1ei4KH4qWiDfGeBJs5 MPgiBzgXKinTMMw0sYEewhz6mq4unmakxp5l69Qv+pPERxXEMZwDpl0VvpTBohgKVfYp Ieyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mD/ecWR+ZPrc+Vn69RUwS/sk/5bYSuo4wAU0dFePbbc=; b=piR52XPK/Qz0bJC3lIl81POSwQxIqVVbEnMlOZRNTd6xDQJQ7V9S/09iCdv36iLPb/ ELvVw83itXPP8dJMzDHxEF/uGWKoP+4cG3SiOh0p7Ee4AlwzjLdRiUR5B1kI+Kf6IOFd XKhDS+JsUxg3AQd9cf/QMD1zuHeAu42jZ8I07zf/yz68jt7nuBjEhaf3hK5ANm74YMIW 9xdXePn3jV8RkxmeyRBuh50tzEjEXnsAnYb4u6JPr7d1nlemzN9T8FelFk539hFK5eLh ss1vk4P29FKhujdUGU0jN1cXYljiaHC3UFoTeEP35x1fE/OWCBQnr+VrvSuGn6IlvmRz eCWQ== X-Gm-Message-State: AElRT7FM0GIr3uJgJlQAIXJoHMCYHYZ9i3/57n8v6fX9oI4wYtSB5pgX p1zmb1VGSb1HER3o7WjQvgXs6chKSqEbqNFvM83fJA== X-Received: by 2002:a24:464e:: with SMTP id j75-v6mr9538836itb.28.1522857828253; Wed, 04 Apr 2018 09:03:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.11.158 with HTTP; Wed, 4 Apr 2018 09:03:47 -0700 (PDT) In-Reply-To: <20180404120002.6561a5bc@gandalf.local.home> References: <20180404115310.6c69e7b9@gandalf.local.home> <20180404120002.6561a5bc@gandalf.local.home> From: Joel Fernandes Date: Wed, 4 Apr 2018 09:03:47 -0700 Message-ID: Subject: Re: [PATCH] ring-buffer: Add set/clear_current_oom_origin() during allocations To: Steven Rostedt Cc: LKML , Michal Hocko , Zhaoyang Huang , Ingo Molnar , kernel-patch-test@lists.linaro.org, Andrew Morton , "open list:MEMORY MANAGEMENT" , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 4, 2018 at 9:00 AM, Steven Rostedt wrote: > On Wed, 4 Apr 2018 11:53:10 -0400 > Steven Rostedt wrote: > >> @@ -1162,35 +1163,60 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) >> static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu) >> { >> struct buffer_page *bpage, *tmp; >> + bool user_thread = current->mm != NULL; >> + gfp_t mflags; >> long i; >> >> - /* Check if the available memory is there first */ >> + /* >> + * Check if the available memory is there first. >> + * Note, si_mem_available() only gives us a rough estimate of available >> + * memory. It may not be accurate. But we don't care, we just want >> + * to prevent doing any allocation when it is obvious that it is >> + * not going to succeed. >> + */ > > In case you are wondering how I tested this, I simply added: > > #if 0 >> i = si_mem_available(); >> if (i < nr_pages) >> return -ENOMEM; > #endif > > for the tests. Note, without this, I tried to allocate all memory > (bisecting it with allocations that failed and allocations that > succeeded), and couldn't trigger an OOM :-/ I guess you need to have something *else* other than the write to buffer_size_kb doing the GFP_KERNEL allocations but unfortunately gets OOM killed? Also, I agree with the new patch and its nice idea to do that. thanks, - Joel