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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 B4F06C2BA19 for ; Mon, 13 Apr 2020 15:12:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 656D92073E for ; Mon, 13 Apr 2020 15:12:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 656D92073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D44068E0122; Mon, 13 Apr 2020 11:12:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF3C38E0104; Mon, 13 Apr 2020 11:12:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE5338E0122; Mon, 13 Apr 2020 11:12:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id A3FF58E0104 for ; Mon, 13 Apr 2020 11:12:09 -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 640D0180AD807 for ; Mon, 13 Apr 2020 15:12:09 +0000 (UTC) X-FDA: 76703172378.09.beam73_6a0e59524091e X-HE-Tag: beam73_6a0e59524091e X-Filterd-Recvd-Size: 3690 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Apr 2020 15:12:08 +0000 (UTC) IronPort-SDR: 41ZipUTIGdTACwqda06nwAqKE254Z4Y3DLhw8EWLxfzJ+S8FLu7Vu+v/7z5/4yOUl8lezfYwW8 ZbL1aJaLxgUQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 08:12:02 -0700 IronPort-SDR: 5ovm+3aNlY5JeFBIp9hCB57sR/i0YZc9XXs/RuhyVpRwbXl7IbEuP2IyUpzW3KpyM647xsdQE/ fjV2Ufjl/PXA== X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="453186629" Received: from ahduyck-mobl1.amr.corp.intel.com (HELO [10.254.29.128]) ([10.254.29.128]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 08:12:02 -0700 Subject: Re: [RFC PATCH 4/4] mm: Add PG_zero support To: Matthew Wilcox , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrea Arcangeli , Dan Williams , Dave Hansen , David Hildenbrand , Michal Hocko , Andrew Morton , Alex Williamson References: <20200412090945.GA19582@open-light-1.localdomain> <20200412101223.GK21484@bombadil.infradead.org> From: Alexander Duyck Message-ID: <5eb37d79-6420-fcb9-2b4c-6cc6194afcd9@linux.intel.com> Date: Mon, 13 Apr 2020 08:11:59 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200412101223.GK21484@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US 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 4/12/2020 3:12 AM, Matthew Wilcox wrote: > On Sun, Apr 12, 2020 at 05:09:49AM -0400, liliangleo wrote: >> Zero out the page content usually happens when allocating pages, >> this is a time consuming operation, it makes pin and mlock >> operation very slowly, especially for a large batch of memory. >> >> This patch introduce a new feature for zero out pages before page >> allocation, it can help to speed up page allocation. >> >> The idea is very simple, zero out free pages when the system is >> not busy and mark the page with PG_zero, when allocating a page, >> if the page need to be filled with zero, check the flag in the >> struct page, if it's marked as PG_zero, zero out can be skipped, >> it can save cpu time and speed up page allocation. > > We are very short on bits in the page flags. If we can implement this > feature without using another one, this would be good. > > If the bit is only set on pages which are PageBuddy(), we can definitely > find space for it as an alias of another bit. I had considered doing something similar several months back because one of the side effects in the VM is that most of the pages appear to have been zeroed by page reporting. However the problem is that in order to handle the zeroing case you have to push the flag outside the PageBuddy region, and you cannot guarantee that the page is even expected to be zeroed since it might have been zeroed before it was freed, so it is just adding work of having to clear an extra flag some time after allocation. 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.