From patchwork Tue Aug 18 18:47:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11722101 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 79951913 for ; Tue, 18 Aug 2020 18:47:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4539E20772 for ; Tue, 18 Aug 2020 18:47:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bQ/GzzWC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4539E20772 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 725336B0092; Tue, 18 Aug 2020 14:47:15 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6ADD28D0003; Tue, 18 Aug 2020 14:47:15 -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 48DC56B0095; Tue, 18 Aug 2020 14:47:15 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 2285B6B0092 for ; Tue, 18 Aug 2020 14:47:15 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DDB8C8248047 for ; Tue, 18 Aug 2020 18:47:14 +0000 (UTC) X-FDA: 77164571988.13.egg30_0e12bcb27021 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id B379918140B67 for ; Tue, 18 Aug 2020 18:47:14 +0000 (UTC) X-Spam-Summary: 1,0,0,caa0f743681cbce5,d41d8cd98f00b204,3msi8xwykcgycydlesksskpi.gsqpmryb-qqozego.svk@flex--yuzhao.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:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4385:5007:6261:6653:6742:8660:8957:9969:10004:10400:10450:10455:11026:11638:11658:11914:12043:12050:12296:12297:12438:12555:12895:13069:13148:13161:13229:13230:13311:13357:14096:14097:14181:14394:14659:14721:19904:19999:21080:21444:21627:21939:21987:21990:30054,0,RBL:209.85.222.201:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04yrw4n93u84q8z69ogbjhsh5d7sdychxd8gnrr69o9i46kno4gangiinnuphaw.asma4uiare9k1k9u7o4tix9kh588fsrb9w1xddhdkqagy34h1z43oy14gy8qoxn.n-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, X-HE-Tag: egg30_0e12bcb27021 X-Filterd-Recvd-Size: 4613 Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 18:47:14 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id f18so13799284qke.0 for ; Tue, 18 Aug 2020 11:47:14 -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=gehHRqDo170D8ggpcqt5L8gyM4hpiP3lcUb1NEGWSW0=; b=bQ/GzzWCVMuhyt2laZU2VxcoEcEJ0awKHw177BB3iK9JBuhbMoqOMb55rEFzzispi4 ywbPZWNcaLgifIEPXSTOz563MWK+2uyPYoJ0xUHlueLw8MgtrLdr8wbNjMFUN+Or3S0P iFQIqxP58WduRybClJ8bhoc927M7lCiLlkV056WLQRc3mFjEth5caAjZwDkc0tSlDRK7 PR4W0wMOT8pAoPiyhV5ylKxZPeOSn9Qj6yms7eHC9/mfODiKNLp2EDPyQcC/1OlsvYma q9N9WYkzvVBiWbNQ07qYsS7ND29LTFcqHnC9eCJY4qJyPTjUgMP56T2G8gvL5L+zvWDx lx8g== 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=gehHRqDo170D8ggpcqt5L8gyM4hpiP3lcUb1NEGWSW0=; b=fvmFfa6vwp4REilJx4z3GxYreeEIQSNp/YEj3TfyPfV9wCSdDru5V7+jy0ESKOmi8T fLL+cwkrutGqFYsfhUu4f+1YmlCeVa3N4lRTs/ubCt995bNZWvjsH/9cIgBZBzw9AsVf diRwyXzY6rKbB1UgBEUvJslgPkOhlDIM5AUy2qT6HVw6hyo5rTo26MF6savhNQ6QSlMH GyhoTFbh6YcxH2ruUGApAUl3Z0ivSuP3zhMlYu2pKQgOJN3HIDCa2Nd3OV2x3SckyT8s BnCjKpz8HDq7TCLItyTE+Idn8p6xgYskiUTCZTqv23Ri03UMFbgtEok76LoDZgLShUPl 7Ciw== X-Gm-Message-State: AOAM530Toos3Baray+m0nuY/5D3mMjR5Ow06Q7lNnbZCcGv1Rh2a1BA5 CkK47/eX24H98hwPcv+pLbRx3Anmigo= X-Google-Smtp-Source: ABdhPJyX7PxrdwZp8JKMZ0YQglNCQFusxUHnYaz351dVMOTyN3ebFvNOcxIaiSUrRohWV46bcjlxOvwE/VU= X-Received: by 2002:ad4:54c6:: with SMTP id j6mr20694395qvx.126.1597776433446; Tue, 18 Aug 2020 11:47:13 -0700 (PDT) Date: Tue, 18 Aug 2020 12:47:03 -0600 In-Reply-To: <20200818184704.3625199-1-yuzhao@google.com> Message-Id: <20200818184704.3625199-2-yuzhao@google.com> Mime-Version: 1.0 References: <20200818184704.3625199-1-yuzhao@google.com> X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH v2 2/3] mm: remove superfluous __ClearPageActive() 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: B379918140B67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: To activate a page, mark_page_accessed() always holds a reference on it. It either gets a new reference when adding a page to lru_pvecs.activate_page or reuses an existing one it previously got when it added a page to lru_pvecs.lru_add. So it doesn't call SetPageActive() on a page that doesn't have any reference left. Therefore, the race is impossible these days (I didn't brother to dig into its history). For other paths, namely reclaim and migration, a reference count is always held while calling SetPageActive() on a page. SetPageSlabPfmemalloc() also uses SetPageActive(), but it's irrelevant to LRU pages. Signed-off-by: Yu Zhao --- mm/memremap.c | 2 -- mm/swap.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/mm/memremap.c b/mm/memremap.c index 03e38b7a38f1..3a06eb91cb59 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -451,8 +451,6 @@ void free_devmap_managed_page(struct page *page) return; } - /* Clear Active bit in case of parallel mark_page_accessed */ - __ClearPageActive(page); __ClearPageWaiters(page); mem_cgroup_uncharge(page); diff --git a/mm/swap.c b/mm/swap.c index 25c4043491b3..999a84dbe12c 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -900,8 +900,6 @@ void release_pages(struct page **pages, int nr) del_page_from_lru_list(page, lruvec, page_off_lru(page)); } - /* Clear Active bit in case of parallel mark_page_accessed */ - __ClearPageActive(page); __ClearPageWaiters(page); list_add(&page->lru, &pages_to_free);