Received: by 10.213.65.68 with SMTP id h4csp861992imn; Wed, 4 Apr 2018 08:28:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx48HjmS4Iq2MH/UdjvGHW9XMDnejimDU6yGp/JFSmHowszEn7e4gGnqMeCa3Bpo/R9xx4gEH X-Received: by 10.99.114.27 with SMTP id n27mr12038191pgc.177.1522855720746; Wed, 04 Apr 2018 08:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522855720; cv=none; d=google.com; s=arc-20160816; b=HABqGqsgq1oyYPHuXC56arp7lZtwto2LKPn2YDH2O1RKB3Kc4ebHq17nHibYYi4ZR8 G6OGNhI1h6VMvFzAoRuXP7Ds8wOz2KxgaWmPsZbj0U+O2gnCd6RlvOQjNkDROKRyKF77 ZqfTDTO0720rtvv6yWnOpLnbyQ0N2l+eXAhHYxCKbl2ImVaZhdkEKBBghWVJI5yjlvRY ouzr+FXeLIuTEmCEkxYA05sOyTtrtsw7dir0UpMUQvc1ugP2UMjQNnt5+P6sC64xq8F7 pbkjRoH6RzBCfjK7r41Fyd0P9Fy4kYZH/wtgQaDYFWputCqBlZqel/m+J07dkogLiDKr 7yhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mLVlzaBOZkTR9Ln8IhTF6gO+rj6qMn4YpPPsB/4YTlA=; b=JUNSO+V+xKtWrejKWfwWP2Tl7V14yoKl2fW2xT9mVcUpGHNzOxlb1OBo11sprNbdPJ JlOIaarvYQBgdlUpZGK5sb7rx5BoglxWufqdDIHbiybE+bhm985GxYrPr6sZvM2LTkXl 2f+qZDioZUoQraVqWozoPYS1xLcXCUEyTC3vR27gYJnrFzvkV2aHOHDg5DHIkL+1mQ1l tOT+NplR0vGL2KD6XrGdkeoZaa0i8SXgdo6x8VgkHoFjaLBdNLEX0loSZ8rmZ/ftJ6YF tH8efoL39kCltJA06IT0EjhEdFeQiSMEQ67VHmTflDedPJhdzKbSN1xOBGHO4D6UynXg dDmA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si4257242pfw.173.2018.04.04.08.28.25; Wed, 04 Apr 2018 08:28:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbeDDP1Q (ORCPT + 99 others); Wed, 4 Apr 2018 11:27:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:42428 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbeDDP1P (ORCPT ); Wed, 4 Apr 2018 11:27:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 671E2ADC4; Wed, 4 Apr 2018 15:27:14 +0000 (UTC) Date: Wed, 4 Apr 2018 17:27:13 +0200 From: Michal Hocko To: Steven Rostedt Cc: Zhaoyang Huang , Ingo Molnar , linux-kernel@vger.kernel.org, kernel-patch-test@lists.linaro.org, Andrew Morton , Joel Fernandes , linux-mm@kvack.org, Vlastimil Babka Subject: Re: [PATCH v1] kernel/trace:check the val against the available mem Message-ID: <20180404152713.GM6312@dhcp22.suse.cz> References: <20180403135607.GC5501@dhcp22.suse.cz> <20180403101753.3391a639@gandalf.local.home> <20180403161119.GE5501@dhcp22.suse.cz> <20180403185627.6bf9ea9b@gandalf.local.home> <20180404062039.GC6312@dhcp22.suse.cz> <20180404085901.5b54fe32@gandalf.local.home> <20180404141052.GH6312@dhcp22.suse.cz> <20180404102527.763250b4@gandalf.local.home> <20180404144255.GK6312@dhcp22.suse.cz> <20180404110442.4cf904ae@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180404110442.4cf904ae@gandalf.local.home> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 04-04-18 11:04:42, Steven Rostedt wrote: [...] > I'm not looking for perfect. In fact, I love what si_mem_available() > gives me now! Sure, it can say "there's enough memory" even if I can't > use it. Because most of the OOM allocations that happen with increasing > the size of the ring buffer isn't due to "just enough memory > allocated", but it's due to "trying to allocate crazy amounts of > memory". That's because it does the allocation one page at a time, and > if you try to allocate crazy amounts of memory, it will allocate all > memory before it fails. I don't want that. I want crazy allocations to > fail from the start. A "maybe this will allocate" is fine even if it > will end up causing an OOM. OK, fair enough. It's your code ;) I would recommend using the oom_origin thingy to reduce the immediate damage and to have a clear culprit so that I do not have to scratch my head why we see an OOM report with a lot of unaccounted memory... I am afraid I cannot help you much more though. -- Michal Hocko SUSE Labs