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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 1F585C2BA19 for ; Fri, 24 Apr 2020 00:42:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D31DE20724 for ; Fri, 24 Apr 2020 00:42:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="H3Zm81/h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D31DE20724 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7B5528E0005; Thu, 23 Apr 2020 20:42:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 767388E0003; Thu, 23 Apr 2020 20:42:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67BAA8E0005; Thu, 23 Apr 2020 20:42:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 4EE558E0003 for ; Thu, 23 Apr 2020 20:42:04 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 11F158248047 for ; Fri, 24 Apr 2020 00:42:04 +0000 (UTC) X-FDA: 76740896568.05.month67_8637151ef4b4b X-HE-Tag: month67_8637151ef4b4b X-Filterd-Recvd-Size: 3825 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Apr 2020 00:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4AdspqavztR41mCN3oiG0KE8fZVOClkZARRy1ufwIEw=; b=H3Zm81/hes7RES+nwbKtow+CTh VzOWJrKeo8KSn/Mv1qbyLDl2B5pwS08COcWMQsfvUzpIYU3gQwYZ5Dw54Kqo9cAE/4uMCn0NC7tDx VHVrcn1fUPVmL/MArJwD+E3FzML3qXP3o+TceNuWXhK5CTzGzADGLpHXfeKksn8X1JNziZjohctN+ dEoAif01nmB5AzFyLKSkjqMxIOaQBU1MhtmZ2j4+53jS4vXU8gFfwG7zWEZshhWKJemAbuDLsng2X iOAAZyMV1ewsE0lsf4ZSuWPOi0RDvMDQC4e5JyLZylv2MzeSVmr0JsA1QFMvjPxpBYLBQ3qnrZR2h e7/Ec1ZA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRmPg-0007FP-AL; Fri, 24 Apr 2020 00:41:52 +0000 Date: Thu, 23 Apr 2020 17:41:52 -0700 From: Matthew Wilcox To: Andrew Morton Cc: Vlastimil Babka , Alexander Duyck , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Dan Williams , Dave Hansen , David Hildenbrand , Michal Hocko , Alex Williamson Subject: Re: [RFC PATCH 4/4] mm: Add PG_zero support Message-ID: <20200424004152.GD13910@bombadil.infradead.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200423173700.b2c954b3960e4379a4f82e80@linux-foundation.org> 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 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. 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. When I was at Microsoft, there was a usecase that made sense, and that was virtualisation. If the hypervisor has zeroed the page before giving it to the guest, then there's no need for the guest to zero it again. It's already cache hot, and can be given straight to userspace.