From patchwork Fri Sep 18 03:00:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 11783919 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 161FF618 for ; Fri, 18 Sep 2020 03:01:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D02A7238EE for ; Fri, 18 Sep 2020 03:01:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="uhe9Xs7m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D02A7238EE 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 06DCC6B0073; Thu, 17 Sep 2020 23:01:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F3DB38E0001; Thu, 17 Sep 2020 23:01:02 -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 D8E456B0075; Thu, 17 Sep 2020 23:01:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id BAA1C6B0073 for ; Thu, 17 Sep 2020 23:01:02 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8C1B28249980 for ; Fri, 18 Sep 2020 03:01:02 +0000 (UTC) X-FDA: 77274680364.19.error43_4d0d8f127127 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 6BAEA1AD1B7 for ; Fri, 18 Sep 2020 03:01:02 +0000 (UTC) X-Spam-Summary: 1,0,0,5970287ade648721,d41d8cd98f00b204,37sjkxwykcmq849rkyqyyqvo.mywvsx47-wwu5kmu.y1q@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:1535:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2693:3138:3139:3140:3141:3142:3152:3352:3865:3871:4321:4385:5007:6261:6653:6742:8957:9010:9592:9969:10004:10400:11026:11658:11914:12043:12296:12297:12438:12555:12895:12986:13069:13311:13357:14096:14097:14181:14394:14659:14721:21080:21444:21627:30054:30070,0,RBL:209.85.219.202:@flex--yuzhao.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04ygrdssday5spqnygpd6eu433pbhocsa5bj5wzd75wrzm19sshttt5qszubu84.7ybtkt8g6ynz57nsusdhtth9gqe3sc9qmkuezyrm41rcswjyq9jzmz1qkbfdrmm.c-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_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: error43_4d0d8f127127 X-Filterd-Recvd-Size: 5033 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 03:01:02 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id 140so2798254ybf.2 for ; Thu, 17 Sep 2020 20:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=DFpxxJ/kEtxVo0cZzaDv049JSd9o65lBb+rEHr6i344=; b=uhe9Xs7mtBzscpnO7yF3U+4MIVtZCHxNqpxEHtIXeMwLhLvt2SDYP0tVoo6HC4xD+W T8UFMl0etXGRXhZaQBsVcHy+El+zDM7QlJ0hGnUAzLF4hfhzbDInRMeYTOqjfFNd60ZH HhY41XfU6a8zt7cihboW9vmQ7OQqQjhicIQZpH7ToLLD9MRHD9RRhSn9bzTLe2SfDuGH SJIGhmFfn4ys616614QgdqfST0P7nPCOEuqaBbe/iQvvHLLJdIJy3aoLlIDve4bRxL00 ZgRT7Jj42mdwuk8z1nzvKGSelnGbanOQescafc84VCW7x1aYLSk5nSIsMKNmEhcgP1f0 jn/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DFpxxJ/kEtxVo0cZzaDv049JSd9o65lBb+rEHr6i344=; b=dywWVMfCBAgGqTSyI8qhdxsVoo3rc0a20N/7jLsC+oJXp33qpsneDIM3mWlcRqZmM5 MzsgD9ZrXZrUXc4TgyOrmWoM00THO69pmHCsNNLmilzbl0ogKpyQWjdtZpMjtLujtjUS YZo8iZOIUdJXA1xl5qfhs9Vl+3eI88/eCXTINhcIwgf30GFFfK8P1j8ljI+q2NqC2xX3 fVMedcZk4QMi/uYcMg+ruBIrJ+34F7Vqjniyx9wpmj7eqPbfnTq4u6ePxMO/pARtkhbP cGrV6lkvr6wZkJuTp8w9dCU2ET0yBNVrnhuZnlSafKBAw2HU+Yx5Ap1pa88AADB5/sh/ w55Q== X-Gm-Message-State: AOAM531G7gIukzxDm/exahOMP+rTI4mVQ4KjuD7yvDpG5bcLvOmE7nUa XTFUOzmOz/WZv01nj1/w/884Tg5H+v0= X-Google-Smtp-Source: ABdhPJxvYNBbzfpbEV/xXQvUGEXI4OEuFOhsF5B7Jlz9/8AmN6ttG/IsDz0Z+wl6pHj8lTKer6JSac8C7o8= X-Received: from yuzhao.bld.corp.google.com ([2620:15c:183:200:7220:84ff:fe09:2d90]) (user=yuzhao job=sendgmr) by 2002:a25:55c5:: with SMTP id j188mr33342607ybb.417.1600398061369; Thu, 17 Sep 2020 20:01:01 -0700 (PDT) Date: Thu, 17 Sep 2020 21:00:40 -0600 In-Reply-To: <20200918030051.650890-1-yuzhao@google.com> Message-Id: <20200918030051.650890-3-yuzhao@google.com> Mime-Version: 1.0 References: <20200918030051.650890-1-yuzhao@google.com> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH 02/13] mm: use page_off_lru() From: Yu Zhao To: Andrew Morton , Michal Hocko Cc: Alex Shi , Steven Rostedt , Ingo Molnar , Johannes Weiner , Vladimir Davydov , Roman Gushchin , Shakeel Butt , Chris Down , Yafang Shao , Vlastimil Babka , Huang Ying , Pankaj Gupta , Matthew Wilcox , Konstantin Khlebnikov , Minchan Kim , Jaewon Kim , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yu Zhao 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: This patch replaces the only open-coded __ClearPageActive() with page_off_lru(). There is no open-coded __ClearPageUnevictable()s. Before this patch, we have: __ClearPageActive() add_page_to_lru_list() After this patch, we have: page_off_lru() if PageUnevictable() __ClearPageUnevictable() else if PageActive() __ClearPageActive() add_page_to_lru_list() Checking PageUnevictable() shouldn't be a problem because these two flags are mutually exclusive. Leaking either will trigger bad_page(). Signed-off-by: Yu Zhao --- mm/vmscan.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 503fc5e1fe32..f257d2f61574 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1845,7 +1845,6 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, int nr_pages, nr_moved = 0; LIST_HEAD(pages_to_free); struct page *page; - enum lru_list lru; while (!list_empty(list)) { page = lru_to_page(list); @@ -1860,14 +1859,11 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec, lruvec = mem_cgroup_page_lruvec(page, pgdat); SetPageLRU(page); - lru = page_lru(page); - add_page_to_lru_list(page, lruvec, lru); if (put_page_testzero(page)) { __ClearPageLRU(page); - __ClearPageActive(page); - del_page_from_lru_list(page, lruvec, lru); + del_page_from_lru_list(page, lruvec, page_off_lru(page)); if (unlikely(PageCompound(page))) { spin_unlock_irq(&pgdat->lru_lock);