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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 3EE79C55186 for ; Fri, 24 Apr 2020 00:37:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EEA3C20728 for ; Fri, 24 Apr 2020 00:37:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="mCcuVeIx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEA3C20728 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 82F8D8E0006; Thu, 23 Apr 2020 20:37:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DF6A8E0003; Thu, 23 Apr 2020 20:37:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CD7B8E0006; Thu, 23 Apr 2020 20:37:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 4E6878E0003 for ; Thu, 23 Apr 2020 20:37:03 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 148D652C1 for ; Fri, 24 Apr 2020 00:37:03 +0000 (UTC) X-FDA: 76740883926.25.cars22_5a9abcefb233b X-HE-Tag: cars22_5a9abcefb233b X-Filterd-Recvd-Size: 3902 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 24 Apr 2020 00:37:02 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1AB9F20724; Fri, 24 Apr 2020 00:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587688621; bh=tC2001WkgCBwNlCeRGsPzZqCfwtG295aimilTWbtkPk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mCcuVeIxrvSePAS4k6nimdfYFtNup9/RbCL8uQOKtsUv1PIhP3zQ420IcUVF4qPOZ hw+2Pte9WnQGQLDmBjLhybNgT1iYhcX0MiyH/qnxsrbvvvCaR3OyF9Gjs4DTYb0NOZ 9LMi8hZsa+qoYSJYWwj5+mK1ys6TNdGkeYA8GXFQ= Date: Thu, 23 Apr 2020 17:37:00 -0700 From: Andrew Morton To: Vlastimil Babka Cc: Alexander Duyck , Matthew Wilcox , 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: <20200423173700.b2c954b3960e4379a4f82e80@linux-foundation.org> In-Reply-To: <344a3a78-62ad-48fe-40cf-18993175d1e0@suse.cz> 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> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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, 22 Apr 2020 16:09:00 +0200 Vlastimil Babka wrote: > On 4/13/20 11:05 PM, Andrew Morton wrote: > > On Mon, 13 Apr 2020 08:11:59 -0700 Alexander Duyck wrote: > > > >> In addition, unlike madvising the page away there is a pretty > >> significant performance penalty for having to clear the page a second > >> time when the page is split or merged. > > > > I wonder if there might be an issue with increased memory traffic (and > > increased energy consumption, etc). If a page is zeroed immediately > > before getting data written into it (eg, plain old file write(), > > anonymous pagefault) then we can expect that those 4096 zeroes will be > > in CPU cache and mostly not written back. But if that page was zeroed > > a "long" time ago, the caches will probably have been written back. > > Net result: we go from 4k of memory traffic for a 4k page up to 8k of > > memory traffic? > > 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.