From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7616EC2D0E6 for ; Wed, 25 Mar 2020 18:43:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3AAD120777 for ; Wed, 25 Mar 2020 18:43:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AAD120777 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CFF686B00BC; Wed, 25 Mar 2020 14:43:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB0936B00BD; Wed, 25 Mar 2020 14:43:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B77E16B00BF; Wed, 25 Mar 2020 14:43:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0170.hostedemail.com [216.40.44.170]) by kanga.kvack.org (Postfix) with ESMTP id 991156B00BC for ; Wed, 25 Mar 2020 14:43:40 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7395E8248047 for ; Wed, 25 Mar 2020 18:43:40 +0000 (UTC) X-FDA: 76634758200.22.spade81_774f07920ab3a X-HE-Tag: spade81_774f07920ab3a X-Filterd-Recvd-Size: 6457 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Mar 2020 18:43:39 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id u10so4534290wro.7 for ; Wed, 25 Mar 2020 11:43:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Uuuu15S3Kyc9TStNBJHDTZBNWuEUNfLJcKFbNl2E3ak=; b=QQuivmh5qv1y8PCVelvVNoq8lEzT+VOfaX7Fzrh7d37BTr89QgmGBsWYB7ZXPH/Jjd 2IzqN07jJBA4XaY5ZX6VyLWbF9qAjw1/0yzLfCCR7E5Q6G663T1O2R/DUmlZSvur3nrT TQqbdxXJBheBfE++ZRhEjjVev4z6G3QZUjUMuZuyL1Wx8xwaUooxF10ze68/GeFcejqF 74FUcDyIdDLV5/Ts5BCzToXjMNynQq34xGR2fr+eS2l9GUoLiOT2xPHKhhjNPvJ8snhL MbkLutYaaFreNpRaFHt+bo4Np1T5ejsZs/2Na4UJ1l3xAgSLtcsq9Puo7Yuyf9IwqTmE jN4w== X-Gm-Message-State: ANhLgQ3mwTkxmQAVWvdZBVlp8WFks5SqVy6Lz9byUiKF+xyGsKJSjSZW QcpkUBqDFIUgOSb7AQWpRmc= X-Google-Smtp-Source: ADFU+vvI1klbpKVPWn8YpWe2D+GWNkeKHFE8BNprleAEk/fO1fTc0ue9LQM02CLxTVivVYKcPfpcjw== X-Received: by 2002:a5d:4683:: with SMTP id u3mr4835052wrq.248.1585161817463; Wed, 25 Mar 2020 11:43:37 -0700 (PDT) Received: from localhost (ip-37-188-135-150.eurotel.cz. [37.188.135.150]) by smtp.gmail.com with ESMTPSA id i5sm1833460wrr.12.2020.03.25.11.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 11:43:36 -0700 (PDT) Date: Wed, 25 Mar 2020 19:43:35 +0100 From: Michal Hocko To: Alexander Potapenko Cc: Matthew Wilcox , Vegard Nossum , Andrew Morton , Dmitry Vyukov , Marco Elver , Andrey Konovalov , Linux Memory Management List , Al Viro , Andreas Dilger , Andrey Ryabinin , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Christoph Hellwig , Christoph Hellwig , "Darrick J. Wong" , David Miller , Dmitry Torokhov , Eric Biggers , Eric Dumazet , Eric Van Hensbergen , Greg Kroah-Hartman , Harry Wentland , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jason Wang , Jens Axboe , Marek Szyprowski , Mark Rutland , "Martin K . Petersen" , Martin Schwidefsky , "Michael S. Tsirkin" , Michal Simek , Petr Mladek , Qian Cai , Randy Dunlap , Robin Murphy , Sergey Senozhatsky , Steven Rostedt , Takashi Iwai , Theodore Ts'o , Thomas Gleixner , Vasily Gorbik , Wolfram Sang Subject: Re: [PATCH v5 03/38] kmsan: gfp: introduce __GFP_NO_KMSAN_SHADOW Message-ID: <20200325184335.GK19542@dhcp22.suse.cz> References: <20200325161249.55095-1-glider@google.com> <20200325161249.55095-4-glider@google.com> <20200325161952.GF19542@dhcp22.suse.cz> <20200325174916.GC22483@bombadil.infradead.org> <20200325180941.GD22483@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 25-03-20 19:30:09, Alexander Potapenko wrote: > On Wed, Mar 25, 2020 at 7:09 PM Matthew Wilcox wrote: > > > > On Wed, Mar 25, 2020 at 07:03:32PM +0100, Alexander Potapenko wrote: > > > > I would suggest using bits in the section labelled: > > > > > > > > /* Unserialized, strictly 'current' */ > > > > > > The main problem is that |current| is unavailable in the interrupt > > > context, so we'll also need to: > > > - disable interrupts when preparing for a KMSAN internal memory > > > allocation - sounds costly, huh? > > > - store the context flag in a per-cpu variable in the case |current| > > > is unavailable. > > > > It's not /unavailable/ ... it's whatever task happens to be running at > > the time the interrupt is triggered. You can borrow its task_struct. > > That didn't come to my mind, interesting! > > > You'll have to save off the current value of the flag before setting it, > > just like memalloc_nofs_save() does. > > But this does rather call into question whether Michal's advice to use > > task_struct is good advice to begin with. For memalloc_nofs/noio, > > it works well this way because allocations in interrupt context are > > inherently at a more restrictive context than task level. It's not clear > > to me what this kmsan GFP flag is being used for, and whether allocations > > that happen in interrupt context should inherit the kmsan setting. > > The idea behind this flag is as follows. > KMSAN must allocate metadata pages for every allocation performed by > alloc_pages(). > Metadata allocations are also done via alloc_pages(), and for those no > further metadata needs to be allocated. > Thus the GFP flag is used to prevent the recursion in alloc_pages(). Kmemleak used the same approach IIRC. It turned out to be unusable in a presence of any higher GFP_NOWAIT memory pressure. Anyway talk to Catalin Marinas about problems he had to go through to address them. -- Michal Hocko SUSE Labs