Received: by 10.213.65.68 with SMTP id h4csp1872437imn; Sun, 1 Apr 2018 17:54:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/2w2yxhqS3CBPeY4VN5sfWKszAlzJ2/ddPTKUBcvI1a/pErHehtmsoYGacYHjQ4JpC6Iue X-Received: by 2002:a17:902:28e4:: with SMTP id f91-v6mr8030455plb.336.1522630464009; Sun, 01 Apr 2018 17:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522630463; cv=none; d=google.com; s=arc-20160816; b=iB7WKPwBOcxKivK3QGL8K1tH/mP2ImS6030n6tAhxG38UNimJouIFDrJGtJkThvCIK HHn9UDS3A7Fmw2Co8XKjm/x18Mx/7aHMgvS+DVi1qU9aQ8Cu9RSOns5oVnKf0055nQXO sJTTV6hB52l5ntHeWzWB4rrzss/m0PuTCRgoOMOuawnWwnOTquovf040cnKswj4hcUmb yu4HBc+AXo6zNJcnpNur4MqM9STVjr04NlkkBee6kqQxj7cV7Qy5JmWlEYdZIyFSRSAn McYUHAXLEVX9t5kptn5kHinVKove54zNxFjU1omRrLKRm9raIl3CT/Kyy+cZMOjedP+y dXKQ== 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=gqqcfeywXx12jRKoReEB+8Y4i7Ik62kUvqXi29EErhM=; b=ZTcnOMpFQ+zE/T+1Qs70xXXtGqb68W154wV+dUFgtj2Ub7ffsCVRTVZDb6ZzAtWTHJ lv6lUfQTNpp8CfmSGNSBQQtTdCul83gyeZ8Bq48HuwE2ZBJ4U6AS0HjlLFo3zewTwpvp 4gxlJCA/IU8CHUaYtKMmUAqMlNUUk8mu9/2xWrC9BMo7pvoDw8VhmmmcYFaV3YzMrz29 XQzuVmAoyk+MdU0VbBbJ0keFckjT9A353TeGnIncJ39qzGrCQjEYDom6pqPJUpFETw6j +VUlgpdq33Zr/H5hS5hz9S8oUNKcCqv6u5FWNkEx5+m49iGNCL2in4U9shex2rpdJg6E hbiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TQytakJg; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12si9122138pgu.155.2018.04.01.17.54.10; Sun, 01 Apr 2018 17:54:23 -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=@gmail.com header.s=20161025 header.b=TQytakJg; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbeDBAww (ORCPT + 99 others); Sun, 1 Apr 2018 20:52:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51312 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753988AbeDBAwu (ORCPT ); Sun, 1 Apr 2018 20:52:50 -0400 Received: by mail-wm0-f68.google.com with SMTP id v21so22856919wmc.1 for ; Sun, 01 Apr 2018 17:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gqqcfeywXx12jRKoReEB+8Y4i7Ik62kUvqXi29EErhM=; b=TQytakJgZHpmVFuHmuzoBH4zz7d9O/AcSk6Y8BFIb5jtmxRCbgODp6pLcYbZZfsMau gljhPvcWrYMKzw5sDHF1OQWTZl51eP3BXz0k8wUFE6Wh45KgbD4Xk9PVYpqj7Z0qC0/2 HFJR5JAGxCrSqeOKedgXlIbcefLF5hoRMI6M0iiKXiMw7LokNIob48l6q7vGfLTuAbmm VvvgmhOIXGtl2Ag8Hy4zvGGqZ8rygDAIe3iu5f5TGcWoY6hd+3LNiROsKDjGaKgylPpb 2IcI74EUxV9Kmrv7/ZrGxXe2t2Q5oV+z/WUj0JD9/puNEOJGeQq/ZVuNZJ81FhCKZozZ GGkw== 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=gqqcfeywXx12jRKoReEB+8Y4i7Ik62kUvqXi29EErhM=; b=YFe0OMUOE1CqIWBgFGjKmkqO81StwhRRU4kiI7iI1W32jDedipA87kwpGN+mA7/oon VmIdxEayMljL382DcntnsWk3l221fnXzNIVYzBnda2dqktWrPciRugzGKJrIx63EgEXu FgHSnvA9AAfaCHkyG5geiYG97q1jZulsemZMlRSUFZccCx70f26bjMJ3ulO+oIURoLJr bEqc2nnG6gFOOltUCX1Q1FfbyIaTJuFTfRcDYGLs9NZ1XWuCDtDirbGqakffgN5ihoy/ xIJdvz9nn395r7RWn3jAQwcJIVe7RcLlWLsWwiP2nUMJVjsuavv0i6lNiemTun5+fJs8 ecjg== X-Gm-Message-State: AElRT7GEmSQ45tWCHe5+QTu/o8AkBq5piY90x+018QXrBjrVCiSxZsKg EBKXZCcSrriJDq/Xg6QnBjL6L6XGTOmuB4FtvKk= X-Received: by 10.80.232.129 with SMTP id f1mr10862503edn.0.1522630369795; Sun, 01 Apr 2018 17:52:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.201.76 with HTTP; Sun, 1 Apr 2018 17:52:49 -0700 (PDT) In-Reply-To: <20180330174209.4cb77003@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> <20180330174209.4cb77003@gandalf.local.home> From: Zhaoyang Huang Date: Mon, 2 Apr 2018 08:52:49 +0800 Message-ID: Subject: Re: [PATCH v1] kernel/trace:check the val against the available mem To: Steven Rostedt Cc: Matthew Wilcox , 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 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 Sat, Mar 31, 2018 at 5:42 AM, Steven Rostedt wrote: > 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; > /* Hi Steve, It works as my previous patch does.