From patchwork Sun Apr 12 09:08:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 11484487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D005C81 for ; Sun, 12 Apr 2020 09:14:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E17D206DA for ; Sun, 12 Apr 2020 09:14:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hoeVsy/P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E17D206DA 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 CE5928E00C9; Sun, 12 Apr 2020 05:14:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C949A8E0007; Sun, 12 Apr 2020 05:14:24 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B83BA8E00C9; Sun, 12 Apr 2020 05:14:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 9FF128E0007 for ; Sun, 12 Apr 2020 05:14:24 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 661555DC2 for ; Sun, 12 Apr 2020 09:14:24 +0000 (UTC) X-FDA: 76698642048.10.stew75_7dbab60a1f41c X-Spam-Summary: 2,0,0,0ef6e2e23d1d2792,d41d8cd98f00b204,liliang.opensource@gmail.com,,RULES_HIT:41:355:379:800:960:965:966:973:988:989:1260:1277:1312:1313:1314:1345:1381:1431:1437:1516:1518:1519:1535:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2693:2731:3138:3139:3140:3141:3142:3353:3865:3866:3870:3871:4117:4321:4385:4390:4395:5007:6120:6261:6653:6737:8603:9413:10004:10400:11026:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12895:12986:13161:13229:13439:13869:13895:14096:14097:14181:14687:14721:21080:21444:21451:21554:21627:21666:21990:30005:30054:30064,0,RBL:209.85.214.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: stew75_7dbab60a1f41c X-Filterd-Recvd-Size: 6160 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Sun, 12 Apr 2020 09:14:23 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id t4so2330188plq.12 for ; Sun, 12 Apr 2020 02:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=hUbPx5am7etltmgoue9kYTx6WYTCCq/rXLPPJIBdwBM=; b=hoeVsy/PTGVtnZswBoThfSYj3QyaEdgABmWYzdgE9+v4MzxAcHXiHwFyVjvbGuPHDt 4cn1IWPV/t2tu5UVyplPVhq37lKqT/grtiihag1SZkKY6U+ypcsPgBGDNp1GItKNePFN biT7HlJHUef1ciLA/ywlvGGsG3PZkt1qQ5eM1Z21pSkdQ0eO+FhbxJ+7b5BO/VcaTszo nCWEKZBYiFBHhu+5SSUOMtOcPnlL7X9WnI4ENXAxSiDPemNEPkXjequM6r3ZVI7K6KRQ EkN8IKN5geL2OuSBZFen07/5LuU5FK4oCNY8Ujl1uHhX6mQDEippj0an3EZTa6n7g/rM gvvw== 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:subject:message-id:mail-followup-to :mime-version:content-disposition:user-agent; bh=hUbPx5am7etltmgoue9kYTx6WYTCCq/rXLPPJIBdwBM=; b=M/e4FDiSEKbonsblEe5xHTr+n17y+dkNYVICiPrI73ONIV5kbJKTo4p0Fypqs8xsL/ 83sDzfcg65u8MEkcq4m9blFBbtpwQnWKFCavDQyssd+crwilfkQAFTHl85a8uQUBODZN JIPkORzSfKWbNT6S8VyD5TMGAxoFcQ2Cg5HzlIpNa+BDhFfR08T8VSQIs+XGxdNe3Mzg fLBwCCIJou19C85UCJ2cZIo37v5KSJU45+Td+zOqh+VeotRgSjIpdxG6dKbzy7y81qul pAo7JZFpGRJxwynYSE+SW+9rTHvt3vSPIVWcLPpZ2uos8G3NpRV0i+n0Ls7HpLLLcpdK dtsw== X-Gm-Message-State: AGi0Pub7FQjNxNjPw9TlsrDwLwN5SNhkJfMH9lytpbVQYocgwLO7Ufoz VEKovGuJt6AcInsQXUOCumg= X-Google-Smtp-Source: APiQypIi6PdmqU07abT760TSvrN+rjwg5fAVXPTDAPmm3ult7jHtilBHeAO7O8+uyjKEljrcAf1Bng== X-Received: by 2002:a17:90a:f00b:: with SMTP id bt11mr15479384pjb.71.1586682863092; Sun, 12 Apr 2020 02:14:23 -0700 (PDT) Received: from open-light-1.localdomain ([66.98.113.28]) by smtp.gmail.com with ESMTPSA id bt19sm6173756pjb.3.2020.04.12.02.14.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2020 02:14:22 -0700 (PDT) From: liliangleo X-Google-Original-From: liliangleo Date: Sun, 12 Apr 2020 05:08:56 -0400 To: Alexander Duyck , 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 Subject: [RFC PATCH 2/4] mm: Add batch size for free page reporting Message-ID: <20200412090853.GA19578@open-light-1.localdomain> Mail-Followup-To: Alexander Duyck , 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 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: Use the page order as the only threshold for page reporting is not flexible, add a batch size as another threshold, so the reporting will be triggered only when the amount of free page is bigger than the batch size. 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 Signed-off-by: liliangleo --- mm/page_reporting.c | 2 ++ mm/page_reporting.h | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mm/page_reporting.c b/mm/page_reporting.c index 3a7084e508e1..dc7a22a4b752 100644 --- a/mm/page_reporting.c +++ b/mm/page_reporting.c @@ -14,6 +14,8 @@ #define PAGE_REPORTING_DELAY (2 * HZ) #define MAX_SCAN_NUM 1024 +unsigned long page_report_batch_size __read_mostly = 4 * 1024 * 1024UL; + static struct page_reporting_dev_info __rcu *pr_dev_info __read_mostly; enum { diff --git a/mm/page_reporting.h b/mm/page_reporting.h index aa6d37f4dc22..f18c85ecdfe0 100644 --- a/mm/page_reporting.h +++ b/mm/page_reporting.h @@ -12,6 +12,8 @@ #define PAGE_REPORTING_MIN_ORDER pageblock_order +extern unsigned long page_report_batch_size; + #ifdef CONFIG_PAGE_REPORTING DECLARE_STATIC_KEY_FALSE(page_reporting_enabled); void __page_reporting_notify(void); @@ -33,6 +35,8 @@ static inline bool page_reported(struct page *page) */ static inline void page_reporting_notify_free(unsigned int order) { + static long batch_size; + /* Called from hot path in __free_one_page() */ if (!static_branch_unlikely(&page_reporting_enabled)) return; @@ -41,8 +45,12 @@ static inline void page_reporting_notify_free(unsigned int order) if (order < PAGE_REPORTING_MIN_ORDER) return; - /* This will add a few cycles, but should be called infrequently */ - __page_reporting_notify(); + batch_size += (1 << order) << PAGE_SHIFT; + if (batch_size >= page_report_batch_size) { + batch_size = 0; + /* This add a few cycles, but should be called infrequently */ + __page_reporting_notify(); + } } #else /* CONFIG_PAGE_REPORTING */ #define page_reported(_page) false