Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp75470ybk; Fri, 8 May 2020 14:27:03 -0700 (PDT) X-Google-Smtp-Source: APiQypLs27tIRemIwLmo2lFfcsdGDW2TJ2Q2LBSedwbm+9KchIJB5pSvNCfsHHkmAiz4xrepjJEw X-Received: by 2002:aa7:cd6a:: with SMTP id ca10mr3926175edb.332.1588973223167; Fri, 08 May 2020 14:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588973223; cv=none; d=google.com; s=arc-20160816; b=vqaBi/q4kUTGJqwmjBXoQSI6KIVP4DjNMz6sacyJQHJhv34YzjFK2Pp+4cWxS3FiF0 63qPQMYWPa1p6GUWzusmwDf1lko0AVSAdHSohMSHxWcxcVNFm0vKakJ4WSsP6KuFA2za Dv5f43iXmPW9eZuaYsl7AExVkG3sKudsmx9NXYL6+pkItgE8/n6q3JF1DWIr/Io+vj37 OJpSqiMs0Sf6UO2HNAAMJ2tpOaUR1fSqsbZVhlLv9GrRtplYXe75vCnN3gxYiTbHzUSN yIPQDwtx9iMWdmYU1rYfc4NVuvQoQnx7ZgESNr2qq2pUVrGDYdcDMXt+qts2zzhAviML 2H2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=+lPomwo6gVp+8sIw/I2u7q5nAUGKdenRSc6ButB2wWA=; b=Tr+xiyWmwL+DSSl+qHMPUJDUs4MLIbbNPug4Y3H1ZAzu46rdPketMJ0gZLWKlL966a 37OnCw8KlCuj9nRrTjEd+XzJdSCkaOfAm6Zl9JklalKc5Ekm/Tp98IOKqUW64X9lD/Uz ik1dzHgABrZqBt42SkjkG5B6pWtADK2dvr+cBCz22cSsbUk2PJ2rKilmvzOgBYe0XSQY SDWIhQD/4ZZvClYE7wP0uO7FvqOEC/YF9kmj22d4Vgg6yDzh5ADYeoy+l3xjqYdq4KqL BXrvx2VQ2zViK5SSP9CSs2gHGBvRbyOsaQXwajySv/f8mI4k7D8QSbGkmMLF6iYSFMjE EWHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Y/d3gs9c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1720906edx.421.2020.05.08.14.26.40; Fri, 08 May 2020 14:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Y/d3gs9c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727984AbgEHVWo (ORCPT + 99 others); Fri, 8 May 2020 17:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727816AbgEHVWo (ORCPT ); Fri, 8 May 2020 17:22:44 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A51FC05BD43 for ; Fri, 8 May 2020 14:22:44 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id b13so3051651pfp.2 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=V2MaIWYZbizDUO32Jl8nU40DtBxdvL8fDnBlV4OdQ9MTyRqNKGf9qHffNlqAGGH7fk ftzw/JcYGlgYP7M6LZQIxM/9GNKfUitBIKAO+p53b93Esh7/zrzm27jrF6yWC3zKV5M2 iSO6LsZILyOeOS376gaKFpjnoCu9XZuTd8I5guBC7J9I+Jy4u6XJKYzFndIVkJ9c0sIv KxJWo00WHcQiBbGbaVIuggJFfjCWI62/ntDW6AUOGyEQMUggLArZZk7XYTSK6bjnvWYh W5snwIz7j5XG+PnhTkmlWJud34ZyzQhD4QukRsfRlknT9U9OrjoepotI7vtGoGdt6v+I LLKg== X-Gm-Message-State: AGi0PuY+BMttu+9XceWpP2Ez9EfBfem8BuKl1mEcuQAtW33NbgjQM+kv VpeTVFPDmcYqHwuYURsMtEJoIsxhtVHubw== 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 { -- 2.26.2.645.ge9eca65c58-goog