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=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 4F121C07E95 for ; Tue, 20 Jul 2021 07:28:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E67C961175 for ; Tue, 20 Jul 2021 07:28:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E67C961175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 77B568D0002; Tue, 20 Jul 2021 03:28:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72B338D0001; Tue, 20 Jul 2021 03:28:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A5048D0002; Tue, 20 Jul 2021 03:28:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 37C2E8D0001 for ; Tue, 20 Jul 2021 03:28:38 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id C7E2426DDC for ; Tue, 20 Jul 2021 07:28:36 +0000 (UTC) X-FDA: 78382138632.38.D957154 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 503435012AF8 for ; Tue, 20 Jul 2021 07:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626766115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kRtDACrxYPJ8ZPr9xqT886xL4OQGjMMieEXBqQ/h2Xw=; b=Pp4PAGvzKKFIdyXSIQfBEWZ/U5PFuXHuf1EcNt5SvyPKWnz13cvAgTog1OK2kdvaqeB1F0 2Wi2KB/YNPLdI+5T/ZiCpiXwgofoDNE+1lPqjNNOyEkd8IdfXpIdY78K7qHX5UjIVicTBk 9AcoJY1wj/s5E88eF0k9UsTb8v7n7sQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-QJrcfLsNNee7gqigqubwBQ-1; Tue, 20 Jul 2021 03:28:34 -0400 X-MC-Unique: QJrcfLsNNee7gqigqubwBQ-1 Received: by mail-wm1-f69.google.com with SMTP id y6-20020a7bc1860000b0290227b53c7cefso898020wmi.1 for ; Tue, 20 Jul 2021 00:28:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kRtDACrxYPJ8ZPr9xqT886xL4OQGjMMieEXBqQ/h2Xw=; b=iupO/N/0n8mVKnpZjTa7yYVNizq6mvhAddI9538qdZvMj21mzrEy/D97s7lvN5uJbb jJ86Iia33PgHEvlfwzV5NO7GQm+5pFYJwSmf/UOu2Q9WFAiPgU5LbfOuHqrFhMYLKPDq icoUPA/0WQBSUwQFxGtKtpsgJqt+7Nq17tqz4yewI3AFzCF1M8eeqbSh9us6K3yu77hS 7VuyAhWliiCSOODS+QI7sAXbs3FaHDsY/J094BSXeu4ATjG48RLOaFsyEteuerObafmi auMJwX8C11mUSKaadrKVOsqEchZd75kfkgEQB9X3JqpeGnhSjUXF4kN3JKj/bJY2EP1f VmUg== X-Gm-Message-State: AOAM5314XDkNCivcpah5M9RBJzhCpRjliCxVfIPeTRHMkQo+0HV5RqA2 4zPkAiMDwPCTcnXKjkqtfSGDBJasYPIu7A+iKcpTGn81gJAlcEa7KLW2WxsYH95wsamBTdndnIC ZoFDfbPm9/H0= X-Received: by 2002:a05:600c:430c:: with SMTP id p12mr36758969wme.16.1626766113298; Tue, 20 Jul 2021 00:28:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzMxJ6tkE66HwBF8toIqiHp2xtf7yK65y8S1dwets2ANEWlErBZCm5ceoCHkuw+2exOcaa8w== X-Received: by 2002:a05:600c:430c:: with SMTP id p12mr36758942wme.16.1626766113065; Tue, 20 Jul 2021 00:28:33 -0700 (PDT) Received: from ?IPv6:2003:d8:2f0a:7f00:fad7:3bc9:69d:31f? (p200300d82f0a7f00fad73bc9069d031f.dip0.t-ipconnect.de. [2003:d8:2f0a:7f00:fad7:3bc9:69d:31f]) by smtp.gmail.com with ESMTPSA id o29sm17750919wms.13.2021.07.20.00.28.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Jul 2021 00:28:32 -0700 (PDT) To: Peter Collingbourne Cc: John Hubbard , Matthew Wilcox , "Kirill A . Shutemov" , Andrew Morton , Catalin Marinas , Evgenii Stepanov , Michal Hocko , Jann Horn , Linux ARM , Linux Memory Management List , kernel test robot , Linux API , linux-doc@vger.kernel.org References: <20210619092002.1791322-1-pcc@google.com> <30e92457-d540-159c-4c4e-0b8f0d2a1838@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v4] mm: introduce reference pages Message-ID: <0345cd7b-0196-1c67-6b6c-a5638a66171b@redhat.com> Date: Tue, 20 Jul 2021 09:28:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Pp4PAGvz; spf=none (imf05.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam02 X-Stat-Signature: u7s4ziscabrbhut3ehafemw4jzt37c5x X-Rspamd-Queue-Id: 503435012AF8 X-HE-Tag: 1626766116-543767 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: >>> --- a/include/linux/gfp.h >>> +++ b/include/linux/gfp.h >>> @@ -55,8 +55,9 @@ struct vm_area_struct; >>> #define ___GFP_ACCOUNT 0x400000u >>> #define ___GFP_ZEROTAGS 0x800000u >>> #define ___GFP_SKIP_KASAN_POISON 0x1000000u >>> +#define ___GFP_NOZERO 0x2000000u >> >> Oh god, please no. We've discussed this a couple of times already: >> whatever leaves the page allcoator shall be zeroed. No exceptions, not >> even for other allocators (like hugetlb). >> >> Introducing something like that to the whole system, including random >> drivers, destroys the whole purpose of the security feature. Please >> don't burry something so controversial in your patch. >=20 > Got it -- I was unaware that this was controversial. >=20 > Avoiding the double initialization does help a bit in benchmarks, at > least for the fully faulted case. The alternative approach that I was > thinking of was to somehow plumb the required pattern into the page > allocator (which would maintain the invariant that the pages are > initialized, but not necessarily with zeroes), but this would require > touching several layers of the allocator. I suppose that this doesn't > need to be done immediately though -- we can deal with the double > initialization for now and avoid it somehow in a followup. As it's a clear optimization, it should definitely be separated from=20 this "introduction" patch. I agree that the logic for optimizing initialization of a page in this=20 case should best reside in page_alloc.c, for example providing a helper=20 for optimizing the initialization in there. We already pass alloc_flags=20 internally, maybe we can then reuse that to minimize changes. --=20 Thanks, David / dhildenb