Received: by 10.213.65.68 with SMTP id h4csp104607imn; Tue, 3 Apr 2018 16:30:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+hUIwNgR3V7J5v/9dsaQrecONzRyNw2dTkMo+YPF3V+EDRqdEkSv26nhiQ8fSfqWqC9I5P X-Received: by 2002:a17:902:a981:: with SMTP id bh1-v6mr16465789plb.255.1522798248172; Tue, 03 Apr 2018 16:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522798248; cv=none; d=google.com; s=arc-20160816; b=iljdCdcSz3yTsGWZ3As4ssLnt3c1su2p+4CZPV/FRBxyZry3zbewHW2hdiZztvGO7j vflSq+nxhc+BrYDrAgmtrdkL8BhCR0fKtR9MQ1SKM6IY40TaYeLsAa31Gxq/93c9g4Iu uLTUrUeCdQl4WBZni+/dElEa1iV7QeD49Z1LOzFRmlMu6aTwCzn1U28djCkSuSnWiuhH Q0sdJgSPhSmFayGiVWJvWuxPVxToS/garRKfdqKlpsV9Vv9tZkzsksURi9sGRUyoqqJ8 7hG9aVfPeZqlDceBBtQhg4tD4WhhBQw7DGl9xGGdsvRL17RVwCs/QLYazHqzvBFMKxu2 /Lag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=HcCLbcV4I9Gam7clxnRkxC6YqUkXxxuYg+2VM7eEAUM=; b=vrm1Z54uU6kyAD3kGRJhSbLjTFBMfuMdIhyup/443Pu5Ea8FlDQeKUcYEg4S5DZpgr dYINP6WCh+XWWWriz5LseULOv0jApKKv8Crz3h63Vi3PueOZ1afE4bisWXJId3yX+hXB 6EwAM68fLmlTg02B9w5YU+Ap3q5A46DD1pt44O1S+GJua0B+KHUH8PAaBxc4uigwbnJS T6OPjmPd939IVoqANX6K7TgV6eMaBbbfn+VtOUyUaE0697ucsxQy9RLbsIF72pKoUcdc 7K0QQwMOl07+hc9CiUOwQSNWGHpqJRpp8+C82d1JsffVwWVvNGOWuOLlpAbfABfROGqL i/HQ== 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 94-v6si1697536ple.56.2018.04.03.16.30.34; Tue, 03 Apr 2018 16:30:48 -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 S1755615AbeDCW4b convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Apr 2018 18:56:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:51998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753356AbeDCW4a (ORCPT ); Tue, 3 Apr 2018 18:56:30 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E48AE20CAA; Tue, 3 Apr 2018 22:56:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E48AE20CAA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Tue, 3 Apr 2018 18:56:27 -0400 From: Steven Rostedt To: Michal Hocko 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: <20180403185627.6bf9ea9b@gandalf.local.home> In-Reply-To: <20180403161119.GE5501@dhcp22.suse.cz> References: <1522320104-6573-1-git-send-email-zhaoyang.huang@spreadtrum.com> <20180330102038.2378925b@gandalf.local.home> <20180403110612.GM5501@dhcp22.suse.cz> <20180403075158.0c0a2795@gandalf.local.home> <20180403121614.GV5501@dhcp22.suse.cz> <20180403082348.28cd3c1c@gandalf.local.home> <20180403123514.GX5501@dhcp22.suse.cz> <20180403093245.43e7e77c@gandalf.local.home> <20180403135607.GC5501@dhcp22.suse.cz> <20180403101753.3391a639@gandalf.local.home> <20180403161119.GE5501@dhcp22.suse.cz> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Apr 2018 18:11:19 +0200 Michal Hocko wrote: > You can do so, of course. In fact it would have some advantages over > single pages because you would fragment the memory less but this is not > a reliable prevention from OOM killing and the complete memory > depletion if you allow arbitrary trace buffer sizes. You are right that this doesn't prevent OOM killing. I tried various methods, and the only thing that currently "works" the way I'm happy with, is this original patch. From your earlier email: > Except that it doesn't work. si_mem_available is not really suitable for > any allocation estimations. Its only purpose is to provide a very rough > estimation for userspace. Any other use is basically abuse. The > situation can change really quickly. Really it is really hard to be > clever here with the volatility the memory allocations can cause. Now can you please explain to me why si_mem_available is not suitable for my purpose. If it's wrong and states there is less memory than actually exists, we simply fail to increase the buffer. If it is wrong and states that there is more memory than actually exists, then we do nothing different than what we do today, and trigger an OOM. But for the ring buffer use case, it is "good enough". Can you please explain to me what issues you see that can happen if we apply this patch? -- Steve