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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 99FC1C43331 for ; Fri, 27 Mar 2020 12:20:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 560C32078B for ; Fri, 27 Mar 2020 12:20:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lG2WeWmK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 560C32078B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EB0D96B0010; Fri, 27 Mar 2020 08:20:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E39B06B0032; Fri, 27 Mar 2020 08:20:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01356B0036; Fri, 27 Mar 2020 08:20:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id B5D4A6B0010 for ; Fri, 27 Mar 2020 08:20:30 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 24112180AD817 for ; Fri, 27 Mar 2020 12:20:30 +0000 (UTC) X-FDA: 76641050220.09.light22_5ba61a94ce005 X-HE-Tag: light22_5ba61a94ce005 X-Filterd-Recvd-Size: 7099 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Mar 2020 12:20:29 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id z5so11185221wml.5 for ; Fri, 27 Mar 2020 05:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Q1wCsYTycGpu1SsYjpF0AKekgUlENsmNg4HNxGyC0sQ=; b=lG2WeWmKCHsUhetIXXvLxf8AZnrD66Cm8dpssT9hhlgxsz5VUgvATA+U4akbtEO3A1 UIQ5nV06C9RSiSsVR0+JsfZ6NE508NNdSvt/dtxaE9W5swUWTXCkYoJvxqm7UBuVYBkL Co+BEOXeU7foNsewk5hod7qnyUHwFd76bSCcnFn6wGHGTCnbo05KREPSFwDnk4tiwYvv ALBq9+Ypocw2yCEHoDYRP/A7bO6i8xKA5+KBY9ioyWmYLlWL2rhlcO+CAAPQ7oTaiUOv el+uxsr/HoAM1B3sfAkMQvWxCwZKbryCZQXcUuIcUoZltsVSWNSUQOQblYyRHC6/j27g KbiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Q1wCsYTycGpu1SsYjpF0AKekgUlENsmNg4HNxGyC0sQ=; b=FaGxO4rxhrX2X3wUmnCHHpMBxqYMJRDQK5ncf9kWiRDuAc19dtpgowbuazTfYrzQo9 Ks2K3wj7j0J4gns2r8Q/oDApB61qu9JTHgb7ELfqXI295cvqqCKjXixL8PJsTxtDzTlt IBLMCOnclOZrCVtkf1XxNa1XW7DWGCXAEnxrSXTc1bZT6MiS2T34cUguL0nPS2ZkvGBP PUWqceQ5DtDOBoZ6qh+ZTX7w5TyPBhQSgrZ6WYhrh+RQT1ghHh/Gstj7RsbUMp8QKosZ MjOe0qC2PLOakWQGVTANACe5SkfnqPg476/3MAGsFuFdLjJBMYM151WI9tISQGmZjeYj JudA== X-Gm-Message-State: ANhLgQ1yDAkkIsYq7IPNITf47RM77QEBon4IaklPdyoYOnlxw91HmsJC /vFdTMYhq0TROx+MUfdBM0mJrP7KzYzf1SZOJV1JLQ== X-Google-Smtp-Source: ADFU+vuY1VML1/XJc4NJFjOVkoRUkt40dOlPlhL8J6uhiR/fGBD3tffbCFPGGTpoytmWQfeGtclsKnk3+1kQwjuTNOk= X-Received: by 2002:a05:600c:22c1:: with SMTP id 1mr4761534wmg.29.1585311628373; Fri, 27 Mar 2020 05:20:28 -0700 (PDT) MIME-Version: 1.0 References: <20200325161249.55095-1-glider@google.com> <20200325161249.55095-4-glider@google.com> <20200325161952.GF19542@dhcp22.suse.cz> <20200325183832.GI19542@dhcp22.suse.cz> In-Reply-To: <20200325183832.GI19542@dhcp22.suse.cz> From: Alexander Potapenko Date: Fri, 27 Mar 2020 13:20:17 +0100 Message-ID: Subject: Re: [PATCH v5 03/38] kmsan: gfp: introduce __GFP_NO_KMSAN_SHADOW To: Michal Hocko Cc: 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 , Matthew Wilcox , "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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, Mar 25, 2020 at 7:38 PM Michal Hocko wrote: > > On Wed 25-03-20 18:40:29, Alexander Potapenko wrote: > > On Wed, Mar 25, 2020 at 6:26 PM Alexander Potapenko = wrote: > > > > > > On Wed, Mar 25, 2020 at 5:19 PM Michal Hocko wrot= e: > > > > > > > > On Wed 25-03-20 17:12:14, glider@google.com wrote: > > > > > This flag is to be used by KMSAN runtime to mark that newly creat= ed > > > > > memory pages don't need KMSAN metadata backing them. > > > > > > > > I really dislike an idea of the gfp flag. If you need some form of > > > > exclusion for kmsan allocations then follow the pattern of memalloc= _no{fs,io}_{save,restore} > > > > History tells us that single usecase gfp flags are too tempting to = abuse > > > > and using incorrectly. > > > > > > Great idea, will do! > > > Guess PF_ flags isn't a scarce resource? > > > > Actually, no, we are out of bits in current->flags already. > > I could introduce a separate flag into struct task, but that won't > > work in interrupt contexts - how do you solve that problem for FS/IO > > allocations? > > NOFS/NOIO is not a problem for IRQ context because we never do reclaim > from that context. > > I was also not aware that there are users from the IRQ context. I > thought this would be an internal KMSAN stuff. What would be the IRQ > context you call this from? KMSAN allocates its metadata lazily*, so if any code does alloc_pages() from IRQ context, we need to call alloc_pages two more times for shadow/origin pages. We also unwind the stack on every creation/copy of an uninitialized value. Those stacks are stored in the stack depot, which may also allocate new pages to store stacks. > Anyway, if you cannot go with the task_struct then a per-cpu value > should work, right? Yes, I will try that. * - as mentioned in the cover letter, a lot of problems could've been solved if we pre-allocate the metadata pages at boot time so that for every two contiguous physical pages their metadata pages are also contiguous. I haven't come up with a good idea about how to implement that. Suggestions are very welcome. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg