From patchwork Fri May 8 21:22:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 11537627 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 2A4E5139F for ; Fri, 8 May 2020 21:22:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E122F2495C for ; Fri, 8 May 2020 21:22:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XY5On+Go" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E122F2495C 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 1038F900012; Fri, 8 May 2020 17:22:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0D9E4900004; Fri, 8 May 2020 17:22:28 -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 01627900012; Fri, 8 May 2020 17:22:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DEC73900004 for ; Fri, 8 May 2020 17:22:27 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9F651181AEF07 for ; Fri, 8 May 2020 21:22:27 +0000 (UTC) X-FDA: 76794825534.05.leg26_89dc27cb5f157 X-Spam-Summary: 2,0,0,57b98af133fbc0ba,d41d8cd98f00b204,3ks21xggkcaetiblffmchpphmf.dpnmjovy-nnlwbdl.psh@flex--shakeelb.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2895:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3874:5007:6261:6653:7903:8957:9969:10004:10400:10450:10455:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:21966:21990:30054:30070,0,RBL:209.85.210.201:@flex--shakeelb.bounces.google.com:.lbl8.mailshell.net-62.18.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:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: leg26_89dc27cb5f157 X-Filterd-Recvd-Size: 5273 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 21:22:27 +0000 (UTC) Received: by mail-pf1-f201.google.com with SMTP id f26so3036209pfn.9 for ; Fri, 08 May 2020 14:22:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=H7ED1E6iU6GJrL2T+LX5Bj/uEQY3JnE8s7k3T/+egkg=; b=XY5On+GozPMjP6G7zkPxPhW0eE2rp4+jjdvdyV+TE6avG+bX2A6pptdCo2RW+Rn3no KQU1jyKtWYfy9dkYUy4EImZ9+uEOAdDNPH0YwlyphH5/olIWRcFiT8PHrG0uYO6VgAgO E/dVasAEh4SuLPL7R9m2RQCh6iAMAIo8SZvlMpxpYiJTLphr4eSjp2MuwGrDq5yyaNzx 4N+w8pQqM2elRyzuI36Dqha8UAGJbBpiCNZBetFNyysG+bhxK79vAv6P6/dmFhDWQ0cZ 53BuMgiu5tPKdTehsHF+yErNAw9OFP+cGYZN4uCLlChZJodaZgBljzVYxcpHxpU3zoun Gm9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=H7ED1E6iU6GJrL2T+LX5Bj/uEQY3JnE8s7k3T/+egkg=; b=CxEURCbLSSNj09W5cW6lJyzHiOVJNsr2BD3c8coWZBPEaLgr2uUV1c2uGaJX1gs7eL Yr47CF5QPfF4uZYz8rR8X3KXC0HdTZTwsvArczPW+EmweH214eJM9d8WwlHTxtpkrLrX ROKyWEe80/ZlRUBdup/tt1aFoVzJQjgTsYruT+oVBGTyqL98Myb+99thYnzrxbCIzdPr vCa1prEZzRbrucqAVBawkUz8a5GuRqBdo3amXLL1L49AADddnuHJ+yEg84EVXoYpCAg2 UXaRrq28+hD8VWTHQDiUc/jB5C+nVhHhqU0XIqQm1o4GG2G1GMaqEiCLv9OuJL931zAW G7lA== X-Gm-Message-State: AGi0PuZ0/Pm8HlHQb+gdcJcMjEbNXS87e78eX1UvtP7EoXzecqVMyd3u wSMpIPUM893eR9DdOKnrvEENW8DFafJ1ow== X-Google-Smtp-Source: APiQypLfungZ5Nzv+f2ielEC+coRuoHMgMXQgXBUaRp75fbEnt3diNF+/f9OMq68YEUmbJsRsjKINr5ubL8GLQ== X-Received: by 2002:a17:90a:cb0b:: with SMTP id z11mr7520557pjt.62.1588972946092; Fri, 08 May 2020 14:22:26 -0700 (PDT) Date: Fri, 8 May 2020 14:22:13 -0700 Message-Id: <20200508212215.181307-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog Subject: [PATCH 1/3] mm: swap: fix vmstats 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: Many of the callbacks called by pagevec_lru_move_fn() do not correctly update the vmstats for huge pages. Fix that. Also __pagevec_lru_add_fn() use the irq-unsafe alternative to update the stat as the irqs are already disabled. Signed-off-by: Shakeel Butt Acked-by: Johannes Weiner --- mm/swap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index a37bd7b202ac..3dbef6517cac 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -225,7 +225,7 @@ static void pagevec_move_tail_fn(struct page *page, struct lruvec *lruvec, del_page_from_lru_list(page, lruvec, page_lru(page)); ClearPageActive(page); add_page_to_lru_list_tail(page, lruvec, page_lru(page)); - (*pgmoved)++; + (*pgmoved) += hpage_nr_pages(page); } } @@ -285,7 +285,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, add_page_to_lru_list(page, lruvec, lru); trace_mm_lru_activate(page); - __count_vm_event(PGACTIVATE); + __count_vm_events(PGACTIVATE, hpage_nr_pages(page)); update_page_reclaim_stat(lruvec, file, 1); } } @@ -503,6 +503,7 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, { int lru, file; bool active; + int nr_pages = hpage_nr_pages(page); if (!PageLRU(page)) return; @@ -536,11 +537,11 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, * We moves tha page into tail of inactive. */ add_page_to_lru_list_tail(page, lruvec, lru); - __count_vm_event(PGROTATED); + __count_vm_events(PGROTATED, nr_pages); } if (active) - __count_vm_event(PGDEACTIVATE); + __count_vm_events(PGDEACTIVATE, nr_pages); update_page_reclaim_stat(lruvec, file, 0); } @@ -929,6 +930,7 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, { enum lru_list lru; int was_unevictable = TestClearPageUnevictable(page); + int nr_pages = hpage_nr_pages(page); VM_BUG_ON_PAGE(PageLRU(page), page); @@ -966,13 +968,13 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, update_page_reclaim_stat(lruvec, page_is_file_lru(page), PageActive(page)); if (was_unevictable) - count_vm_event(UNEVICTABLE_PGRESCUED); + __count_vm_events(UNEVICTABLE_PGRESCUED, nr_pages); } else { lru = LRU_UNEVICTABLE; ClearPageActive(page); SetPageUnevictable(page); if (!was_unevictable) - count_vm_event(UNEVICTABLE_PGCULLED); + __count_vm_events(UNEVICTABLE_PGCULLED, nr_pages); } add_page_to_lru_list(page, lruvec, lru); From patchwork Fri May 8 21:22:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 11537629 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 75B87139F for ; Fri, 8 May 2020 21:22:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 390AD20A8B for ; Fri, 8 May 2020 21:22:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ljlb+5Jo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 390AD20A8B 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 6F509900015; Fri, 8 May 2020 17:22:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A50D900004; Fri, 8 May 2020 17:22:38 -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 5BC23900015; Fri, 8 May 2020 17:22:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 43B07900004 for ; Fri, 8 May 2020 17:22:38 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EB21E824805A for ; Fri, 8 May 2020 21:22:37 +0000 (UTC) X-FDA: 76794825954.22.anger64_8b5aaef950b5b X-Spam-Summary: 2,0,0,7fe1fd69d3bf1816,d41d8cd98f00b204,3nm21xggkcas3slvppwmrzzrwp.nzxwty58-xxv6lnv.z2r@flex--shakeelb.bounces.google.com,,RULES_HIT:41: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:2194:2196:2199:2200:2393:2559:2562:2895:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3868:3871:3874:4117:4250:4321:4385:4605:5007:6261:6653:8957:9969:10004:10400:10450:10455:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555:12679:12895:13161:13229:13870:14096:14097:14181:14394:14659:14721:19904:19999:21080:21220:21444:21451:21627:21966:30054:30070,0,RBL:209.85.215.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:23,LUA_SUMMARY:none X-HE-Tag: anger64_8b5aaef950b5b X-Filterd-Recvd-Size: 6106 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 21:22:37 +0000 (UTC) Received: by mail-pg1-f201.google.com with SMTP id y25so2247274pgl.22 for ; Fri, 08 May 2020 14:22:37 -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=WB4fh0ll1orLfT6cXNAXpIF6IJgnNIJAflmvuUUH6tI=; b=ljlb+5JoPOLhwCwo/9ooaMm5dNWWqB4RKavWnR1bMTb4L6DZlaJkSQfWkg3sAAEQ0X UMnUuP9OvKrvFO2Zf1tnvuK0HExsQ2dYx49Deh2BpHI0OnP5ZatGHYAs8ZTI/yxrils3 xzpe4ILlD48aErissngz/JZQjPXUgLkKPbNMlhHbgVIt6JvI2Qqhq9LILj81H24qLUpd 2GqNHMP6geeEqMap9slI4hgNGU5PWE9SdVjpN1ZygLe6+JYzxYDnJcgw76g8ZJaiwYbx XGaBJ2xHrlPcPEipfB3nycm7Y2ZiWhkuNvSYmpS4fjdgG5Kmdhl2nIvXnPOUcLCgKgr5 47gQ== 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=WB4fh0ll1orLfT6cXNAXpIF6IJgnNIJAflmvuUUH6tI=; b=fe9I7dXZkZ4Mfmstro44iz9ayTQ+Xxxvs8aAkpgojvv4onJbWOvZud/d8duecvZCSR GqV8fMcoleGNALjqovWfDrUbSjp4AwrPsNNaikmOMUh4x1qp+cyftIwLioHmShCog2Nj DmS63IX+jCANyYsfkP6Fb1Nm1uJw/Z6RoZxNQJJhhR1OBgOwK5OWXMxt+GuTBLbmEmdU oTQtOwJtEpN4m4UOfJh1VyjWX7Rlb0nanX2enP83ggGwVQBP8jE8lZDql1uEKifQLDtN fM5TPNJPtq2KzKR0Ke0ZbqFKgnr+4tX0nyPFmzF3b713apnugddI86VZKfCA64qp+vnT ndzg== X-Gm-Message-State: AGi0PuYRbSLTECYEU1mdUHI8TyoBwOXCSiYvX3BdZ0zp8FomsnXx5GDU +GsJiF/8zdAL0y3kka8jOZuCdb+o1NZmPg== X-Google-Smtp-Source: APiQypLOtqKOw6qGIFJrdKSoiXSUY0c+iu42+pRBK9bHu2cCiYtB9/Zi/7+9qgttPV+xyxHeaRmrB0aXGe1j9A== X-Received: by 2002:a17:90a:6f22:: with SMTP id d31mr7728053pjk.14.1588972956538; Fri, 08 May 2020 14:22:36 -0700 (PDT) Date: Fri, 8 May 2020 14:22:14 -0700 In-Reply-To: <20200508212215.181307-1-shakeelb@google.com> Message-Id: <20200508212215.181307-2-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 2/3] mm: swap: memcg: fix memcg stats 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: The commit 2262185c5b28 ("mm: per-cgroup memory reclaim stats") added PGLAZYFREE, PGACTIVATE & PGDEACTIVATE stats for cgroups but missed couple of places and PGLAZYFREE missed huge page handling. Fix that. Also for PGLAZYFREE use the irq-unsafe function to update as the irq is already disabled. Fixes: 2262185c5b28 ("mm: per-cgroup memory reclaim stats") Signed-off-by: Shakeel Butt Acked-by: Johannes Weiner --- mm/swap.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mm/swap.c b/mm/swap.c index 3dbef6517cac..4eb179ee0b72 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -278,6 +278,7 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) { int file = page_is_file_lru(page); int lru = page_lru_base_type(page); + int nr_pages = hpage_nr_pages(page); del_page_from_lru_list(page, lruvec, lru); SetPageActive(page); @@ -285,7 +286,8 @@ static void __activate_page(struct page *page, struct lruvec *lruvec, add_page_to_lru_list(page, lruvec, lru); trace_mm_lru_activate(page); - __count_vm_events(PGACTIVATE, hpage_nr_pages(page)); + __count_vm_events(PGACTIVATE, nr_pages); + __count_memcg_events(lruvec_memcg(lruvec), PGACTIVATE, nr_pages); update_page_reclaim_stat(lruvec, file, 1); } } @@ -540,8 +542,10 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec, __count_vm_events(PGROTATED, nr_pages); } - if (active) + if (active) { __count_vm_events(PGDEACTIVATE, nr_pages); + __count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE, nr_pages); + } update_page_reclaim_stat(lruvec, file, 0); } @@ -551,13 +555,15 @@ static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec, if (PageLRU(page) && PageActive(page) && !PageUnevictable(page)) { int file = page_is_file_lru(page); int lru = page_lru_base_type(page); + int nr_pages = hpage_nr_pages(page); del_page_from_lru_list(page, lruvec, lru + LRU_ACTIVE); ClearPageActive(page); ClearPageReferenced(page); add_page_to_lru_list(page, lruvec, lru); - __count_vm_events(PGDEACTIVATE, hpage_nr_pages(page)); + __count_vm_events(PGDEACTIVATE, nr_pages); + __count_memcg_events(lruvec_memcg(lruvec), PGDEACTIVATE, nr_pages); update_page_reclaim_stat(lruvec, file, 0); } } @@ -568,6 +574,7 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec, if (PageLRU(page) && PageAnon(page) && PageSwapBacked(page) && !PageSwapCache(page) && !PageUnevictable(page)) { bool active = PageActive(page); + int nr_pages = hpage_nr_pages(page); del_page_from_lru_list(page, lruvec, LRU_INACTIVE_ANON + active); @@ -581,8 +588,8 @@ static void lru_lazyfree_fn(struct page *page, struct lruvec *lruvec, ClearPageSwapBacked(page); add_page_to_lru_list(page, lruvec, LRU_INACTIVE_FILE); - __count_vm_events(PGLAZYFREE, hpage_nr_pages(page)); - count_memcg_page_event(page, PGLAZYFREE); + __count_vm_events(PGLAZYFREE, nr_pages); + __count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, nr_pages); update_page_reclaim_stat(lruvec, 1, 0); } } 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 {