From patchwork Tue Aug 18 18:47:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11722099 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 1F512138C for ; Tue, 18 Aug 2020 18:47:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF387206B5 for ; Tue, 18 Aug 2020 18:47:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JVho9R3B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF387206B5 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 834E68D0001; Tue, 18 Aug 2020 14:47:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7BE056B0093; Tue, 18 Aug 2020 14:47:14 -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 6AE5D8D0001; Tue, 18 Aug 2020 14:47:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id 517DE6B0092 for ; Tue, 18 Aug 2020 14:47:14 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 174BB181AC9B6 for ; Tue, 18 Aug 2020 18:47:14 +0000 (UTC) X-FDA: 77164571988.29.smash47_1104ae627021 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id C414418086CD2 for ; Tue, 18 Aug 2020 18:47:13 +0000 (UTC) X-Spam-Summary: 1,0,0,6162655261e76915,d41d8cd98f00b204,3mci8xwykcgubxckdrjrrjoh.frpolqxa-ppnydfn.ruj@flex--yuzhao.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:968:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2897:3138:3139:3140:3141:3142:3152:3353:3865:3867:3868:3870:3871:3872:4321:4385:4419:4605:5007:6119:6261:6653:6742:7903:8957:9010:9969:10004:10400:11026:11658:11914:12043:12296:12297:12438:12555:12679:12895:12986:13161:13229:14096:14097:14181:14394:14659:14721:21080:21444:21451:21627:21740:21990:30054:30091,0,RBL:209.85.219.201:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04y8h7jthihzc7ke539k7r8bmgradypafthehxooa3w497pniaoddxka5qmq11x.ke4pj6bcauwswxmusr4acg5g1qth4kqcxakhhz13pxkmmuasr9wz51uznduiuuu.4-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rul es:0:0:0 X-HE-Tag: smash47_1104ae627021 X-Filterd-Recvd-Size: 5248 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 18:47:13 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id d26so23209506yba.20 for ; Tue, 18 Aug 2020 11:47:13 -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=/E5eAbEMdGecxil6UrL49SnbBNTAteYJO6ZYPEM5dLY=; b=JVho9R3BbAEAJN3/ABbAA0Q8qoaA4DB7htuEZjfa/UrhMXpsJYFmC7+ZhNNZwKO2NQ PUc5iLYdObTaoIIro8tIsaxuloxbDtq2BRHvJ4HImEh99kGzHSMlwGqvrpFkSNH5ILjH 7OMrfDapLBjDBr/Ron5FwpH8Ed9zJSRBQoNzjeni2Bb9CZZZzkBMHI6Mo9WOMW9GV3Ks hGjjHW9qk302727BeP4WxexH6OJY479SyLXh2AXO/Et+r5tnXqWS8TzIEF24kDQVSBkz TVXnU9sXK1hSVqkA4lJrmI7dZxvQJSTmBveDUy51OpONWhUYv5f7/rdQAsba4BdwvKED meng== 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=/E5eAbEMdGecxil6UrL49SnbBNTAteYJO6ZYPEM5dLY=; b=pCmtTnkQQGwTrRF0t8VC5YVkI/NSg54I92WtPck/mT4pWw0mINpyyHDE5L4NBwH3li Hp24/DL5+AZtxs7GV3oQKJREmGpIPSEjuiTfDWmn76ElOv+E9uz35GOd+GKbIjFaWuBB JfI5cB837CEyJaJJY6ZIHjqVAuuEJvdQXmrRUxbz0HzzxYxG97/JcZbFLHogLk8cF5od GOab/ZlISEmNaPmfbHsCH4Ld+tWx3hmEQnRpWI04q/mW5gaJVofGLekdHg945oQ0YW4o OcdNNIvbSgDS2tlGgy4DDcZ+WhH4m9u87LQmBpl5QLLH94dn3677qn1EwiMi9eiAFBS4 LNnQ== X-Gm-Message-State: AOAM533+rVh+nEbJHZnoZVZsbmkQI8m4wbizgMqAxhiYbcTP765J9xgo NStF+5Bvbl5E5YVSuvaVxVl3AI+OnLI= X-Google-Smtp-Source: ABdhPJzU4R0PcrHVEc2b75WaWjsd33ALQzPjuw40VrEB0Drky/Odddmf1lW46QmY6IDqhw2oeSJVIkW1ZK8= X-Received: by 2002:a25:3b0d:: with SMTP id i13mr28488393yba.314.1597776432330; Tue, 18 Aug 2020 11:47:12 -0700 (PDT) Date: Tue, 18 Aug 2020 12:47:02 -0600 Message-Id: <20200818184704.3625199-1-yuzhao@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH v2 1/3] mm: remove activate_page() from unuse_pte() From: Yu Zhao To: Andrew Morton Cc: Alexander Duyck , Huang Ying , David Hildenbrand , Michal Hocko , Yang Shi , Qian Cai , Mel Gorman , Nicholas Piggin , " =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= " , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Yu Zhao X-Rspamd-Queue-Id: C414418086CD2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: We don't initially add anon pages to active lruvec after commit b518154e59aa ("mm/vmscan: protect the workingset on anonymous LRU"). Remove activate_page() from unuse_pte(), which seems to be missed by the commit. And make the function static while we are at it. Before the commit, we called lru_cache_add_active_or_unevictable() to add new ksm pages to active lruvec. Therefore, activate_page() wasn't necessary for them in the first place. Signed-off-by: Yu Zhao Reviewed-by: Yang Shi --- include/linux/swap.h | 1 - mm/swap.c | 4 ++-- mm/swapfile.c | 5 ----- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 661046994db4..df6207346078 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -340,7 +340,6 @@ extern void lru_note_cost_page(struct page *); extern void lru_cache_add(struct page *); extern void lru_add_page_tail(struct page *page, struct page *page_tail, struct lruvec *lruvec, struct list_head *head); -extern void activate_page(struct page *); extern void mark_page_accessed(struct page *); extern void lru_add_drain(void); extern void lru_add_drain_cpu(int cpu); diff --git a/mm/swap.c b/mm/swap.c index d16d65d9b4e0..25c4043491b3 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -348,7 +348,7 @@ static bool need_activate_page_drain(int cpu) return pagevec_count(&per_cpu(lru_pvecs.activate_page, cpu)) != 0; } -void activate_page(struct page *page) +static void activate_page(struct page *page) { page = compound_head(page); if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) { @@ -368,7 +368,7 @@ static inline void activate_page_drain(int cpu) { } -void activate_page(struct page *page) +static void activate_page(struct page *page) { pg_data_t *pgdat = page_pgdat(page); diff --git a/mm/swapfile.c b/mm/swapfile.c index 12f59e641b5e..c287c560f96d 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1925,11 +1925,6 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, lru_cache_add_inactive_or_unevictable(page, vma); } swap_free(entry); - /* - * Move the page to the active list so it is not - * immediately swapped out again after swapon. - */ - activate_page(page); out: pte_unmap_unlock(pte, ptl); if (page != swapcache) {