From patchwork Tue Dec 22 07:49:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 11986099 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=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 00E8EC433E0 for ; Tue, 22 Dec 2020 07:49:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A8E28225AB for ; Tue, 22 Dec 2020 07:49:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8E28225AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1947E6B0085; Tue, 22 Dec 2020 02:49:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11DFB8D0005; Tue, 22 Dec 2020 02:49:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00CE86B0088; Tue, 22 Dec 2020 02:49:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id DAAC76B0085 for ; Tue, 22 Dec 2020 02:49:17 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9C4AE3648 for ; Tue, 22 Dec 2020 07:49:17 +0000 (UTC) X-FDA: 77620142754.25.cake98_5d1788c2745e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 794C81804E3A0 for ; Tue, 22 Dec 2020 07:49:17 +0000 (UTC) X-HE-Tag: cake98_5d1788c2745e X-Filterd-Recvd-Size: 6846 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Dec 2020 07:49:16 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id w5so7884591pgj.3 for ; Mon, 21 Dec 2020 23:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=EteXygXMCMIuOH65MtjowE2DhA9SwUq1uE5SG/8bUGA=; b=LGvosuLiYLgn1b5YwdnJwfvCqo3XbN555xW2S/pLyAc8CuUqtZAGHNlX5OhLPeQRO4 C9wIUC7lj+M+iU2FFT1wsEhktcwBwq76j874fWliVKllFErvCXfAAxAKVekLKJ0fPuX4 w9BPNrCcyE8RLp4U32xhMH4/yOciZ7ZmUVQsi7kvByf34AwsJf2PEPp8adJg0WcVurN9 y91b1qv/triV2c+4b/y4HigHiL/Sk+sYpuqdkd4PTNVp0q5YaDIas0IN7YMD2gFHzTrx eV/AGLh5tP8pePBFiPGWjo4RlSKftL1n+xJaqNVLxg/eXbhAbpkDrS1x2L8CHRsIt1/n D+sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition:user-agent; bh=EteXygXMCMIuOH65MtjowE2DhA9SwUq1uE5SG/8bUGA=; b=fhbKUhrUxXCAW1kPCBiXxcSVUyKRFP9fVqeQ06egOorPbBgeFU/HigLRJ04sIN0Zq0 Y9KLdV1UUD/98+W9YB+q9l3/jx2aiq2VLSmJSFIE7eR/o68AadtMQxN6Zg/APO2sgznL gwMqYTHbY6JQFhyKWF9f7tm4sbS2oMsyjsZDV9XytKlckRZxeJddVNqE87DfN8q0E8/c FMdsSbJCkZwOC1vlj0cLfS7WE5N3vnctr7e4AJtj6X7jYidAqRNsM3w1hrVP4l6Wy4EQ 26dOrEL0zGrjN9BKaeBhL95+wsJWIi22XbkcSSUKyMc6ZeCnkhTUm9f894tr2mn0i7bR bKzw== X-Gm-Message-State: AOAM531WXenU6nmzK1Qr61iEmelB1QXfmdI1ZmCxqtUilrIaAfuuHQ0t jdL44Ab36wU6KV68YU4MdsE= X-Google-Smtp-Source: ABdhPJzBJLHkMIuEbtGr1+LpiBstQirZrxRohNTninbGDYKqZqqMHLh/V9kjyaXQ/gbGgwJskKjqfQ== X-Received: by 2002:a63:445a:: with SMTP id t26mr18659351pgk.402.1608623356116; Mon, 21 Dec 2020 23:49:16 -0800 (PST) Received: from open-light-1.localdomain (66.98.113.28.16clouds.com. [66.98.113.28]) by smtp.gmail.com with ESMTPSA id b189sm19198904pfb.194.2020.12.21.23.49.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 23:49:15 -0800 (PST) From: Liang Li X-Google-Original-From: Liang Li Date: Tue, 22 Dec 2020 02:49:13 -0500 To: Alexander Duyck , Mel Gorman , Andrew Morton , Andrea Arcangeli , Dan Williams , "Michael S. Tsirkin" , David Hildenbrand , Jason Wang , Dave Hansen , Michal Hocko , Liang Li , Mike Kravetz , Liang Li Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org Subject: [RFC PATCH 3/3] mm: support free hugepage pre zero out Message-ID: <20201222074910.GA30051@open-light-1.localdomain> Mail-Followup-To: Alexander Duyck , Mel Gorman , Andrew Morton , Andrea Arcangeli , Dan Williams , "Michael S. Tsirkin" , David Hildenbrand , Jason Wang , Dave Hansen , Michal Hocko , Liang Li , Mike Kravetz , Liang Li , linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: This patch add support of pre zero out free hugepage, we can use this feature to speed up page population and page fault handing. Cc: Alexander Duyck Cc: Mel Gorman Cc: Andrea Arcangeli Cc: Dan Williams Cc: Dave Hansen Cc: David Hildenbrand Cc: Michal Hocko Cc: Andrew Morton Cc: Alex Williamson Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Mike Kravetz Cc: Liang Li Signed-off-by: Liang Li --- mm/page_prezero.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mm/page_prezero.c b/mm/page_prezero.c index c8ce720bfc54..dff4e0adf402 100644 --- a/mm/page_prezero.c +++ b/mm/page_prezero.c @@ -26,6 +26,7 @@ static unsigned long delay_millisecs = 1000; static unsigned long zeropage_enable __read_mostly; static DEFINE_MUTEX(kzeropaged_mutex); static struct page_reporting_dev_info zero_page_dev_info; +static struct page_reporting_dev_info zero_hugepage_dev_info; inline void clear_zero_page_flag(struct page *page, int order) { @@ -69,9 +70,17 @@ static int start_kzeropaged(void) zero_page_dev_info.delay_jiffies = msecs_to_jiffies(delay_millisecs); err = page_reporting_register(&zero_page_dev_info); + + zero_hugepage_dev_info.report = zero_free_pages; + zero_hugepage_dev_info.mini_order = mini_page_order; + zero_hugepage_dev_info.batch_size = batch_size; + zero_hugepage_dev_info.delay_jiffies = msecs_to_jiffies(delay_millisecs); + + err |= hugepage_reporting_register(&zero_hugepage_dev_info); pr_info("Zero page enabled\n"); } else { page_reporting_unregister(&zero_page_dev_info); + hugepage_reporting_unregister(&zero_hugepage_dev_info); pr_info("Zero page disabled\n"); } @@ -90,7 +99,15 @@ static int restart_kzeropaged(void) zero_page_dev_info.batch_size = batch_size; zero_page_dev_info.delay_jiffies = msecs_to_jiffies(delay_millisecs); + hugepage_reporting_unregister(&zero_hugepage_dev_info); + + zero_hugepage_dev_info.report = zero_free_pages; + zero_hugepage_dev_info.mini_order = mini_page_order; + zero_hugepage_dev_info.batch_size = batch_size; + zero_hugepage_dev_info.delay_jiffies = msecs_to_jiffies(delay_millisecs); + err = page_reporting_register(&zero_page_dev_info); + err |= hugepage_reporting_register(&zero_hugepage_dev_info); pr_info("Zero page enabled\n"); }