From patchwork Tue Aug 18 18:47:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11722103 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 7EBA8138C for ; Tue, 18 Aug 2020 18:47:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C2A6206B5 for ; Tue, 18 Aug 2020 18:47:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CIx7kMWb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C2A6206B5 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 A0E508D000D; Tue, 18 Aug 2020 14:47:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 948BA8D0003; Tue, 18 Aug 2020 14:47:16 -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 723E48D000D; Tue, 18 Aug 2020 14:47:16 -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 5A0318D0003 for ; Tue, 18 Aug 2020 14:47:16 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 162561F1B for ; Tue, 18 Aug 2020 18:47:16 +0000 (UTC) X-FDA: 77164572072.25.fact20_4609c2927021 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id DB5871804E3A1 for ; Tue, 18 Aug 2020 18:47:15 +0000 (UTC) X-Spam-Summary: 1,0,0,5bdd08b525844ecb,d41d8cd98f00b204,3mii8xwykcgcdzemftlttlqj.htrqnszc-rrpafhp.twl@flex--yuzhao.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:968:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3152:3353:3608:3865:3866:3867:3868:3870:3871:3872:3874:4321:4385:4605:5007:6261:6653:6742:7903:8957:9592:9969:10004:10400:11026:11473:11638:11639:11658:11914:12043:12297:12438:12555:12895:12986:14096:14097:14181:14394:14659:14721:21080:21324:21444:21627:21939:21987:21990:30054:30090,0,RBL:209.85.219.201:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04ygmufjycyqcsgihummdkzzoqji7yc9kwwxhqhmrinogdqi18osc8qftek9rsm.cbz7ak6faa67srf713gms5onf5wq93rydf8gam77knjr3ghnxxcfmtm9jwfgcua.o-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:neu tral,Cus X-HE-Tag: fact20_4609c2927021 X-Filterd-Recvd-Size: 5730 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Aug 2020 18:47:15 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id l67so23102490ybb.7 for ; Tue, 18 Aug 2020 11:47:15 -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=bfVQLroskM5Wc4DhZMIyj9jgHc+j8RHZ/garHr4Fpmo=; b=CIx7kMWbB8VmYnYBEoD4nNQsaSQZt1zzWgyHBo9TmOh+81P13Aq4a+yETjPZEdKzHt 6xhM+il6SYmrYbNG1IV7d069OMSWVqj57ViYi+dViNBbqPDo4foz1/sXg+neeEwOnROJ b3vK60iuFFWLcpf66/+S0SZnj2eh8Khpc1C4Awp23aYoNw3Hn2ktDyYyIqmyY/lLuNWy 0KsGsEIVRDT/ZcJr7rljERS6QGsxhldWu58VpPBprIVTjCTNGFYgQ/jP9PX7jqtcNwYD yHdVBEoP2GYwds522u6f/lZ7QVEz357iUqWtZYvud/ZMRq5iE6U6JD54o1RFc5iL68P9 PFUQ== 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=bfVQLroskM5Wc4DhZMIyj9jgHc+j8RHZ/garHr4Fpmo=; b=WBa+m3LuIyCL3gyUzPiNOZ3Y2UFlSoYUuzldbiyw22XxpZovuBwZEVY1+xX8ziFsny MCM8FzfioiWjcxhHZiG58p01uOJkPXVhDiuKnqUQFZUyufim1BW7Huigr+8det/m128D 5CX7qY23yyoR5VOfWc7Bwkax+aU7GKL4FgZu4v3khhdHj58Aph4fHFUShdRovweevxtz 0W1q2Cyn7wPU+i0NfYiHzMNDf68AYJYqZeMlMefdAgpmdfzK5gM2a0unAhVs1q8IBvOH B2SFNq7TvUAXuWsw4YyS7rjCo/bxyYksxo92PshstNagl8wwvB20kKx5fmS6sL6mg8qu 8WEA== X-Gm-Message-State: AOAM531b+5s+Uuice2P0SlsAVBltt7KI102o+m0yAM6Dpo26I6KbLKIZ lo0bb+wYpnATeVRNeBijqrP5bpIUDtY= X-Google-Smtp-Source: ABdhPJxZwwFPlarZ3LoosIXt55p8uBBCrvGv9J5VLrCxYXf9wPeT384wi+a1vkBEDJm/7ct0Z09BbNo6pl0= X-Received: by 2002:a25:a091:: with SMTP id y17mr28606051ybh.82.1597776434643; Tue, 18 Aug 2020 11:47:14 -0700 (PDT) Date: Tue, 18 Aug 2020 12:47:04 -0600 In-Reply-To: <20200818184704.3625199-1-yuzhao@google.com> Message-Id: <20200818184704.3625199-3-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 3/3] mm: remove superfluous __ClearPageWaiters() 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: DB5871804E3A1 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: Presumably __ClearPageWaiters() was added to follow the previously removed __ClearPageActive() pattern. Only flags that are in PAGE_FLAGS_CHECK_AT_FREE needs to be properly cleared because otherwise we think there may be some kind of leak. PG_waiters is not one of those flags and leaving the clearing to PAGE_FLAGS_CHECK_AT_PREP is more appropriate. Signed-off-by: Yu Zhao --- include/linux/page-flags.h | 2 +- mm/filemap.c | 2 ++ mm/memremap.c | 2 -- mm/swap.c | 3 --- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6be1aa559b1e..dba80a2bdfba 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -318,7 +318,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } TESTSETFLAG_FALSE(uname) TESTCLEARFLAG_FALSE(uname) __PAGEFLAG(Locked, locked, PF_NO_TAIL) -PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) +PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL) PAGEFLAG(Referenced, referenced, PF_HEAD) TESTCLEARFLAG(Referenced, referenced, PF_HEAD) diff --git a/mm/filemap.c b/mm/filemap.c index 1aaea26556cc..75240c7ef73f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1079,6 +1079,8 @@ static void wake_up_page_bit(struct page *page, int bit_nr) * other pages on it. * * That's okay, it's a rare case. The next waker will clear it. + * Otherwise the bit will be cleared by PAGE_FLAGS_CHECK_AT_PREP + * when the page is being freed. */ } spin_unlock_irqrestore(&q->lock, flags); diff --git a/mm/memremap.c b/mm/memremap.c index 3a06eb91cb59..a9d02ffaf9e3 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -451,8 +451,6 @@ void free_devmap_managed_page(struct page *page) return; } - __ClearPageWaiters(page); - mem_cgroup_uncharge(page); /* diff --git a/mm/swap.c b/mm/swap.c index 999a84dbe12c..40bf20a75278 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -90,7 +90,6 @@ static void __page_cache_release(struct page *page) del_page_from_lru_list(page, lruvec, page_off_lru(page)); spin_unlock_irqrestore(&pgdat->lru_lock, flags); } - __ClearPageWaiters(page); } static void __put_single_page(struct page *page) @@ -900,8 +899,6 @@ void release_pages(struct page **pages, int nr) del_page_from_lru_list(page, lruvec, page_off_lru(page)); } - __ClearPageWaiters(page); - list_add(&page->lru, &pages_to_free); } if (locked_pgdat)