Received: by 10.213.65.68 with SMTP id h4csp346852imn; Fri, 30 Mar 2018 22:46:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/4/nNQDn4+aLSVPGbDKo2f8vvkFN+VZiWtjV5+3eFERjVqoooNNVCkxuzjmwl77SXBwua X-Received: by 2002:a17:902:5a5:: with SMTP id f34-v6mr1878269plf.288.1522475177163; Fri, 30 Mar 2018 22:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522475177; cv=none; d=google.com; s=arc-20160816; b=QP+mlQ2Jdo8KzMjvlwJnsAG7mSAj2B5/1IJGj1PCorsUS5x7qF9U3XNHzFK1bBlIaP Vagoldn7roW2dAQdIJk7GUpnPnS/s2dAiIia4dpoDQ4mNKLjahbkh8C3nVmWyac21+td m5cJADW3QKmFFkeZPlGAK28mSEAQjiLGue6UMreB5Ou0DCfkLCv3gvCeigUGD8xB7COz xu911zVKO9SpXM7zL88DMyYFtJmKZtYjtIPqxVhncK3PvENX8VReuT7cnmyDUCucnUYR 42uZdWBT7TpInb2cJ6xDeqXXg1d5Rgo7OIr7N9Fp3MmPw7Idb3VgQsu2WlB+7AgAdeUT MveA== 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=sYJxTcoT0r6ebCWCs20u1wnZJ311RpQQxUq0nIeRn/w=; b=Vfkjj8HmXF+je3POqochdA8EWtQdPFR/BPEtjpqslfov4SkXUHQMP54pq0O/KRbOuK ZYO3yJoSOHuaaJVgxhtjitiYYb1Icpdkrg/hzm4CVisY3a00ZAuIafwT80Xn5pcBDkw2 Q1oLF0PagXm0VdOU3dzdlsG/okpRSKK6gW2Ppl8j6cFW4vNxIOizotMSaaHralmsbMJ8 zf3tkXSt0/d/+4Aw5aN0f+m5ruhtUQLBoGUALl4P/HnPikBTHC67P7shzZt07BvtQP5o P39yIVWDvjxiS4aws54/UWH31xUw6eE6U4JmQWjb89inGZANgGAJh6Z0OfMKlvujx2+G aNfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ewzl6Td1; 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 w186si6841853pgd.573.2018.03.30.22.46.02; Fri, 30 Mar 2018 22:46:17 -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=Ewzl6Td1; 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 S1751412AbeCaFoy (ORCPT + 99 others); Sat, 31 Mar 2018 01:44:54 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:35797 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbeCaFox (ORCPT ); Sat, 31 Mar 2018 01:44:53 -0400 Received: by mail-io0-f193.google.com with SMTP id x77so6630535ioi.2 for ; Fri, 30 Mar 2018 22:44:52 -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=sYJxTcoT0r6ebCWCs20u1wnZJ311RpQQxUq0nIeRn/w=; b=Ewzl6Td1Byu8Wo/ClFAsYv/JEQyknG28Rw5+X25/K3JxDrov2/th7AiWSgBDZYe+Nl QRA78voS2n20nDCGYcJS9muJNfEpCXC6nYEtTgG5JRw2qL2VDxr4sqlv6KVMZxFcEHd/ lptD/aHZXx4c/8S1cDDYO+ChhYDFibFtWJdHYAsNpOS24s3qfDFPiTbT2PsGIxMVurFV 8kK8XNIWpopF38j89ujWFN5ZPQVkn4XHZ8b0RAHNpyjHdezE5QpwtXwTUN0zeyO/pt65 LkRZiIXuCX1+KrGQqFrLEzmDnuMd2WSiCiwxYhETH2J/Vo2E/dYgA4vC5leGOjsbBV2b 6cbg== 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=sYJxTcoT0r6ebCWCs20u1wnZJ311RpQQxUq0nIeRn/w=; b=Ucq5duqdOtSCHh0nHPRLwy4QOtOXpTz58fCn373+M+w7HqY5krHlHd10w1TeVz123U l+3kW7f9hM2slDc+MqUF64hIwdF7OD4mbjL0KTcTpBFwVfcWVE2HUnOS3N166LOcC5Ru 1nvlInt5g7gdCMSBSQGcqyrmlNtKdsjFP6F98Nr4R1AdFt5zgDGtovwHY9RQ/a6pUkwr 3ytqh7Lv9cyJxfn3uAKRtntK1ei2dcq9wxtnW4NGav+BfkIDD2Krg7xygLAQonWKfSSS o+HBQfNPVtqxpMZvAk3RWIEUzDvskurMxbWUoW1ldWI7DR9duZfeSZ0PDFvaPBooDj/Z lysg== X-Gm-Message-State: AElRT7FahHCIk1Y4lCWN6Ekwvhrd9m5rkvEPT66Nq1Ig1xvLiWFJNF+G YXmRHkZKWljZBA7Pfi/mEfneYSKiLPIQfaFN0o2cOw== X-Received: by 10.107.131.194 with SMTP id n63mr1549918ioi.268.1522475091970; Fri, 30 Mar 2018 22:44:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.11.158 with HTTP; Fri, 30 Mar 2018 22:44:51 -0700 (PDT) In-Reply-To: <20180330230733.2bf010f2@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> <20180330214151.415e90ea@gandalf.local.home> <20180331021857.GD13332@bombadil.infradead.org> <20180330230733.2bf010f2@gandalf.local.home> From: Joel Fernandes Date: Fri, 30 Mar 2018 22:44:51 -0700 Message-ID: Subject: Re: [PATCH v1] kernel/trace:check the val against the available mem To: Steven Rostedt Cc: Matthew Wilcox , Zhaoyang Huang , Ingo Molnar , LKML , kernel-patch-test@lists.linaro.org, Andrew Morton , Michal Hocko , "open list:MEMORY MANAGEMENT" , 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 Fri, Mar 30, 2018 at 8:07 PM, Steven Rostedt wrote: > On Fri, 30 Mar 2018 19:18:57 -0700 > Matthew Wilcox wrote: > >> Again though, this is the same pattern as vmalloc. There are any number >> of places where userspace can cause an arbitrarily large vmalloc to be >> attempted (grep for kvmalloc_array for a list of promising candidates). >> I'm pretty sure that just changing your GFP flags to GFP_KERNEL | >> __GFP_NOWARN will give you the exact behaviour that you want with no >> need to grub around in the VM to find out if your huge allocation is >> likely to succeed. > > Not sure how this helps. Note, I don't care about consecutive pages, so > this is not an array. It's a link list of thousands of pages. How do > you suggest allocating them? The ring buffer is a link list of pages. Yeah I didn't understand the suggestion either. If I remember correctly, not using either NO_RETRY or RETRY_MAY_FAIL, and just plain GFP_KERNEL was precisely causing the buffer_size_kb write to cause an OOM in my testing. So I think Steven's patch does the right thing in checking in advance. thanks, - Joel