Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp333785ybz; Fri, 24 Apr 2020 00:59:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIbhOeQ6E4C466O1Ruwqd4mxKYSR00iKQXd+jkT8VkyjHhJlmabC32OKqqIDMsezw+Hmr78 X-Received: by 2002:a50:b062:: with SMTP id i89mr6154719edd.72.1587715175620; Fri, 24 Apr 2020 00:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587715175; cv=none; d=google.com; s=arc-20160816; b=NV7/15/j7eEoM7wRzQ9bIqfqr1CNP0+4kZ7uBNF8516O8aIRsmVlNNqDg2JetITZaq 2tCTcYek3qb7ejw6NNo4DiUiEXEc4qvkvp+o44bLiin961IiTx2wUDduXxP4FoSXc1XE 55De8n7frpG4FwxOoha8Buqui+bWy6GOWNcagtSbD5OKmQADFd5G83mu4BF1ykidIC3g Uhns3d2PE5yJ/dc/oyZnzMVAULC8hA07cfr5cAyRnlWE+zKBKEgofWOmh2+waHI0cDff TGMUe4mAAxd8oJLcTK+r1/5ntNBTRzZCgCFG6itEt4u6FefON3w6Ufvegpeaf56+IJco af4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=XWrPYuo8P8Hale6OFiD55uf9uURsWCWw/XsRD7GzU1I=; b=CvuLPm+0pVSUByTAvSny8RuasYgXtvGWrQ3CI6H9HHt7zA9hCGH8gJT4lp2e6ddmxW F2XvxV+KGcAybjsukIeAlqGVMep1qTKYfnkwJQ8NGy75iQZGiC22JLR/tjIjX38B9N2w lXZmWgapape+49lU+UnS6UzG0JQjmGGod3VYjjMTOgpnSpAXibnhba6a4qDjikAAPHkR kXAhGdUVABHGSqK/VLh4CI9m1YizUhC+vQkzUfke9PUuJ/f+QI8R1V1hN0k7fM8h3DGJ v97mH3yDQDFc7+oFOF4d49CQ6VqAYyOhEbh5onZu77BEmKk9j3d0el1kRCtTdRTU0+2k NFeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si582281edq.436.2020.04.24.00.59.11; Fri, 24 Apr 2020 00:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726364AbgDXHze (ORCPT + 99 others); Fri, 24 Apr 2020 03:55:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:45914 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbgDXHzd (ORCPT ); Fri, 24 Apr 2020 03:55:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D04A6AAC7; Fri, 24 Apr 2020 07:55:30 +0000 (UTC) Subject: Re: [RFC PATCH 4/4] mm: Add PG_zero support To: David Hildenbrand , Matthew Wilcox , Andrew Morton Cc: Alexander Duyck , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Dan Williams , Dave Hansen , Michal Hocko , Alex Williamson References: <20200412090945.GA19582@open-light-1.localdomain> <20200412101223.GK21484@bombadil.infradead.org> <5eb37d79-6420-fcb9-2b4c-6cc6194afcd9@linux.intel.com> <20200413140537.eb674579cf8c71b4e20581ab@linux-foundation.org> <344a3a78-62ad-48fe-40cf-18993175d1e0@suse.cz> <20200423173700.b2c954b3960e4379a4f82e80@linux-foundation.org> <20200424004152.GD13910@bombadil.infradead.org> From: Vlastimil Babka Message-ID: <09885eda-9772-4228-dece-3dfd42840580@suse.cz> Date: Fri, 24 Apr 2020 09:55:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/24/20 9:28 AM, David Hildenbrand wrote: > On 24.04.20 02:41, Matthew Wilcox wrote: >> On Thu, Apr 23, 2020 at 05:37:00PM -0700, Andrew Morton wrote: >>> On Wed, 22 Apr 2020 16:09:00 +0200 Vlastimil Babka wrote: >>>> Heh, I was quite sure that this is not the first time background zeroing is >>>> proposed, so I went to google for it... and found that one BSD kernel actually >>>> removed this functionality in 2016 [1] and this was one of the reasons. >>>> >>>> [1] >>>> https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/afd2da4dc9056ea79cdf15e8a9386a3d3998f33e >>> >>> Interesting. >>> >>> However this: >>> >>> - Pre-zeroing a page leads to a cold-cache case on-use, forcing the fault >>> source (e.g. a userland program) to actually get the data from main >>> memory in its likely immediate use of the faulted page, reducing >>> performance. >>> >>> implies that BSD was zeroing with non-temporal stores which bypass the >>> CPU cache. And which presumably invalidate any part of the target >>> memory which was already in cache. We wouldn't do it that way so >>> perhaps the results would differ. >> >> Or just that the page was zeroed far enough in advance that it fell out >> of cache naturally. Agreed. >> I know Arjan looked at zeroing on free instead of zeroing on alloc, >> and that didn't get merged (or even submitted afaik), so presumably the >> results weren't good. > > We do have INIT_ON_FREE_DEFAULT_ON > > via > > commit 6471384af2a6530696fc0203bafe4de41a23c9ef > Author: Alexander Potapenko > Date: Thu Jul 11 20:59:19 2019 -0700 > > mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options > > which seems to do exactly that (although for a different use case) Yeah, except the security use case wants to do that immediately, while the proposal here is a background thread.