From patchwork Fri May 8 21:22:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 11537631 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 C30B6139F for ; Fri, 8 May 2020 21:22:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8681620A8B for ; Fri, 8 May 2020 21:22:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Y/d3gs9c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8681620A8B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C7399900016; Fri, 8 May 2020 17:22:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C23FC900004; Fri, 8 May 2020 17:22:45 -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 B1397900016; Fri, 8 May 2020 17:22:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 999B4900004 for ; Fri, 8 May 2020 17:22:45 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5E2A7824805A for ; Fri, 8 May 2020 21:22:45 +0000 (UTC) X-FDA: 76794826290.04.money91_8c6c15b3da42d X-Spam-Summary: 2,0,0,ef3ac5c2f0f7e49e,d41d8cd98f00b204,3o821xggkcbiazs2ww3ty66y3w.u64305cf-442dsu2.69y@flex--shakeelb.bounces.google.com,,RULES_HIT:41:69:152:355:379:541:800:960:966:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1543:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3353:3865:3867:3871:3872:3874:4117:4321:4385:5007:6261:6653:8957:9969:10004:10400:10450:10455:11026:11658:11914:12043:12048:12114:12297:12438:12555:12895:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:30054,0,RBL:209.85.214.201:@flex--shakeelb.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:22,LUA_SUMMARY:none X-HE-Tag: money91_8c6c15b3da42d X-Filterd-Recvd-Size: 6006 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 21:22:44 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id 18so2692538pll.3 for ; Fri, 08 May 2020 14:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=+lPomwo6gVp+8sIw/I2u7q5nAUGKdenRSc6ButB2wWA=; b=Y/d3gs9c8fLWvNo8cv/JRlC7Gdv90wnQcNRlqk6pT0nZP3sUowsrJKLy1ajL1gCIKP BNUeVyKZcJBZjS+0eDdZFhjTK3KefN3ABh56eoNStvjd714RuGjuUnA3L4xeJIFNUkAY bO0mV9zYI5WmPppNa8u/mIKGLHCWC/TjhPqGsKKMVtsXjIEUy6r5sxDfnrG5LunrIWzK c4P45AcNlm8NzX8yWiwIltielavQyQsD9QYT1cC7LRok37X0rUT9i2vJ4vjVhIsWoAUZ ZCn8t+LqSaHTPehqaJHQ7MaZ0Cg0xB93YKJMmUk8rRApPNqqK1qZub7KUWVS80QT7IRV OJow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+lPomwo6gVp+8sIw/I2u7q5nAUGKdenRSc6ButB2wWA=; b=ANMIAml2hWCgYoLrLtPZnjxvbLxizL8opBDi/0IKFmd2VQTk6gag5bZQ7HFAf4ybCq jxJAlBJrVKCQspd0ESUYXfxSJfOcnMXU/fd1WN4AVYUFuDnF3i16zdTaid7PBoMguf6H OqlQ7xZA1B3AnNDhherucY6M7C7Jd4XV+/6+lhO2zo+ndj+4oxc8dBlCY28hnYadn0g5 v6YaeASueGzduWCmVGS+tqCwex3WZ8B8yIZpmNvTdXoBYMxJwh+k3SH7GkX5by4VyqnZ NmS3f/WuBeyrVwyCsBStzjHopxd1JUzig22pVOZqW+rDO0O2lGaY0P68UKNeIHlVTnql EEbw== X-Gm-Message-State: AGi0PuZ36mdzTDS2QO/AkfAOONI6VdTOCpdM6KJdDnKdTAii/44S+Inw pX9Sovgn83MD2iTaljnmgXR/bDxHaygeAg== X-Google-Smtp-Source: APiQypJmqSHJBTT//7e2TqA5OSPQcmtaFbDDtkXqZeIJ65UCsh6cE8u40zY5RJjMUR0eep6ydcbTdiWgYEkrMw== X-Received: by 2002:a63:f14b:: with SMTP id o11mr3831209pgk.429.1588972963716; Fri, 08 May 2020 14:22:43 -0700 (PDT) Date: Fri, 8 May 2020 14:22:15 -0700 In-Reply-To: <20200508212215.181307-1-shakeelb@google.com> Message-Id: <20200508212215.181307-3-shakeelb@google.com> Mime-Version: 1.0 References: <20200508212215.181307-1-shakeelb@google.com> X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog Subject: [PATCH 3/3] mm: swap: fix update_page_reclaim_stat for huge pages From: Shakeel Butt To: Mel Gorman , Johannes Weiner , Roman Gushchin , Michal Hocko Cc: Andrew Morton , Yafang Shao , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Shakeel Butt 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: Currently update_page_reclaim_stat() updates the lruvec.reclaim_stats just once for a page irrespective if a page is huge or not. Fix that by passing the hpage_nr_pages(page) to it. Signed-off-by: Shakeel Butt --- mm/swap.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index 4eb179ee0b72..dc7297cb76a0 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -262,14 +262,14 @@ void rotate_reclaimable_page(struct page *page) } } -static void update_page_reclaim_stat(struct lruvec *lruvec, - int file, int rotated) +static void update_page_reclaim_stat(struct lruvec *lruvec, int file, + int rotated, int nr_pages) { struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat; - reclaim_stat->recent_scanned[file]++; + reclaim_stat->recent_scanned[file] += nr_pages; if (rotated) - reclaim_stat->recent_rotated[file]++; + reclaim_stat->recent_rotated[file] += nr_pages; } static void __activate_page(struct page *page, struct lruvec *lruvec, @@ -288,7 +288,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, __count_vm_events(PGACTIVATE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGACTIVATE, nr_pages); - update_page_reclaim_stat(lruvec, file, 1); + update_page_reclaim_stat(lruvec, file, 1, nr_pages); } } @@ -546,7 +546,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, __count_vm_events(PGDEACTIVATE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE, nr_pages); } - update_page_reclaim_stat(lruvec, file, 0); + update_page_reclaim_stat(lruvec, file, 0, nr_pages); } static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec, @@ -564,7 +564,7 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec, __count_vm_events(PGDEACTIVATE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE, nr_pages); - update_page_reclaim_stat(lruvec, file, 0); + update_page_reclaim_stat(lruvec, file, 0, nr_pages); } } @@ -590,7 +590,7 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec, __count_vm_events(PGLAZYFREE, nr_pages); __count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, nr_pages); - update_page_reclaim_stat(lruvec, 1, 0); + update_page_reclaim_stat(lruvec, 1, 0, nr_pages); } } @@ -928,7 +928,7 @@ void lru_add_page_tail(struct page *page, struct page *page_tail, } if (!PageUnevictable(page)) - update_page_reclaim_stat(lruvec, file, PageActive(page_tail)); + update_page_reclaim_stat(lruvec, file, PageActive(page_tail), 1); } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ @@ -973,7 +973,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, if (page_evictable(page)) { lru = page_lru(page); update_page_reclaim_stat(lruvec, page_is_file_lru(page), - PageActive(page)); + PageActive(page), nr_pages); if (was_unevictable) __count_vm_events(UNEVICTABLE_PGRESCUED, nr_pages); } else {