Received: by 10.213.65.68 with SMTP id h4csp78051imn; Fri, 30 Mar 2018 14:44:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48acwD0zT90ONQ3b55LgdibteFskvbBMVqkvuoaY5AYKNJ4N2q6FkdDmobK3NYHi3u0/TwC X-Received: by 2002:a17:902:6b85:: with SMTP id p5-v6mr696812plk.66.1522446242751; Fri, 30 Mar 2018 14:44:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522446242; cv=none; d=google.com; s=arc-20160816; b=cVKW8Wir5cT0eMfxjDYXRgCH27HGFMK7hs4T040IuE0+TeG4uKSduQ319DSIPgSIMO G2M7ffUjvSFoxFTzemg/RWeSpaTbXkxI+iaCp8qZ50yiKMA1gUE7J1XtRso0+jGVpf3i U6nIxHxD/IrcF8LiihmtI0COnyOwbCBOl7gQ3hFv6u6L5JTrLPVsD/naymszEdYq01SN hxRAkYZPy/gtQjGBVNMJpMGEsh71Q0MabXvCYQaKsAuFVIxGhJAkIk0Ugh1DmKItnkTL l32Gok/w3CPeBb6GJqPvl0k+b2SRW5uIjWr5onzIWnYbgpGJdiJnie4Dzj15zbwAoBJs NHEA== 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=VkqioW5t4EyL5CPWj59i4sas5pgK5IEljXFao5ILrNE=; b=DLRSdfpvlnnhZ0bfnzpnkUhYF4ZujbyetiQt7MihL1kVVSeAtmdoBzgNrv+L4xfJkr QjJRiNazMowsTqWFMrpiQPtEHkT04g3UELFFqKk4jKjlWTQxRHsTNwbb3SF1D8aqkyLs vn8bF/mbDsFZitSKX4w7z0mLI+xtAvRNVMSYd8UmVHGY6k4QJGz1f5hOm3Yk87N1hBrm 42+gpGZmMP6zeIOLRkRcEXmSJoCzIaTzfSnB6dpEEOMgZwVPfljtIxbqCnZWLmyHAKUV Q3Qn7elCTksYuGKa6TMZZ0hJY1eIjtGTYECjGxC8C94GVTb5Lkiv0M7SgBC0pt4FZwP7 1xyA== 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 o69si6901989pfj.329.2018.03.30.14.43.48; Fri, 30 Mar 2018 14:44:02 -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 S1752478AbeC3VmN (ORCPT + 99 others); Fri, 30 Mar 2018 17:42:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:36436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbeC3VmN (ORCPT ); Fri, 30 Mar 2018 17:42:13 -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 5F446217A8; Fri, 30 Mar 2018 21:42:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F446217A8 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: Fri, 30 Mar 2018 17:42:09 -0400 From: Steven Rostedt To: Matthew Wilcox Cc: Zhaoyang Huang , Ingo Molnar , linux-kernel@vger.kernel.org, kernel-patch-test@lists.linaro.org, Andrew Morton , Joel Fernandes , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , Michal Hocko Subject: Re: [PATCH v1] kernel/trace:check the val against the available mem Message-ID: <20180330174209.4cb77003@gandalf.local.home> In-Reply-To: <20180330173031.257a491a@gandalf.local.home> References: <1522320104-6573-1-git-send-email-zhaoyang.huang@spreadtrum.com> <20180330102038.2378925b@gandalf.local.home> <20180330205356.GA13332@bombadil.infradead.org> <20180330173031.257a491a@gandalf.local.home> 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: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Mar 2018 17:30:31 -0400 Steven Rostedt wrote: > I'll take a look at si_mem_available() that Joel suggested and see if > we can make that work. Wow, this appears to work great! Joel and Zhaoyang, can you test this? -- Steve diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index a2fd3893cc02..32a803626ee2 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1164,6 +1164,11 @@ static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu) struct buffer_page *bpage, *tmp; long i; + /* Check if the available memory is there first */ + i = si_mem_available(); + if (i < nr_pages) + return -ENOMEM; + for (i = 0; i < nr_pages; i++) { struct page *page; /*