From patchwork Tue Aug 20 09:48:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 11103507 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 78C131813 for ; Tue, 20 Aug 2019 09:50:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4ED5622DCC for ; Tue, 20 Aug 2019 09:50:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ED5622DCC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 832B96B0272; Tue, 20 Aug 2019 05:50:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7E38A6B0274; Tue, 20 Aug 2019 05:50:40 -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 6D2176B0275; Tue, 20 Aug 2019 05:50:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id 4B1026B0272 for ; Tue, 20 Aug 2019 05:50:40 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id F1DC28248AB7 for ; Tue, 20 Aug 2019 09:50:39 +0000 (UTC) X-FDA: 75842336598.12.grade22_5d0197d2e2559 X-Spam-Summary: 2,0,0,3322037d3cf8c3f9,d41d8cd98f00b204,alex.shi@linux.alibaba.com,:cgroups@vger.kernel.org:linux-kernel@vger.kernel.org::akpm@linux-foundation.org:mgorman@techsingularity.net:tj@kernel.org:alex.shi@linux.alibaba.com:mhocko@suse.com:ktkhai@virtuozzo.com:hannes@cmpxchg.org:daniel.m.jordan@oracle.com:laoar.shao@gmail.com:yang.shi@linux.alibaba.com,RULES_HIT:41:69:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1431:1534:1542:1711:1730:1747:1777:1792:2393:2559:2562:2898:3138:3139:3140:3141:3142:3353:3867:5007:6261:6642:7514:8957:10004:11026:11473:11658:11914:12043:12048:12114:12296:12297:12438:12555:12895:13846:14096:14181:14394:14721:21060:21080:21451:21627:30054:30064:30070,0,RBL:115.124.30.44:@linux.alibaba.com:.lbl8.mailshell.net-62.20.2.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: grade22_5d0197d2e2559 X-Filterd-Recvd-Size: 3733 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Aug 2019 09:50:38 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R971e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0TZztT5U_1566294577; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TZztT5U_1566294577) by smtp.aliyun-inc.com(127.0.0.1); Tue, 20 Aug 2019 17:49:37 +0800 From: Alex Shi To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Mel Gorman , Tejun Heo Cc: Alex Shi , Michal Hocko , Kirill Tkhai , Johannes Weiner , Daniel Jordan , Yafang Shao , Yang Shi Subject: [PATCH 12/14] lru/vmscan: use pre lruvec lock in check_move_unevictable_pages Date: Tue, 20 Aug 2019 17:48:35 +0800 Message-Id: <1566294517-86418-13-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1566294517-86418-1-git-send-email-alex.shi@linux.alibaba.com> References: <1566294517-86418-1-git-send-email-alex.shi@linux.alibaba.com> 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 replace per pgdat lru_lock. Signed-off-by: Alex Shi Cc: Andrew Morton Cc: Michal Hocko Cc: Kirill Tkhai Cc: Johannes Weiner Cc: Daniel Jordan Cc: Yafang Shao Cc: Yang Shi Cc: Mel Gorman Cc: cgroups@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/vmscan.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index defc2c4778eb..123447b9beda 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4249,24 +4249,24 @@ int page_evictable(struct page *page) */ void check_move_unevictable_pages(struct pagevec *pvec) { - struct lruvec *lruvec; - struct pglist_data *pgdat = NULL; + struct lruvec *locked_lruvec = NULL; int pgscanned = 0; int pgrescued = 0; int i; for (i = 0; i < pvec->nr; i++) { struct page *page = pvec->pages[i]; - struct pglist_data *pagepgdat = page_pgdat(page); + struct pglist_data *pgdat = page_pgdat(page); + struct lruvec *lruvec = mem_cgroup_page_lruvec(page, pgdat); pgscanned++; - if (pagepgdat != pgdat) { - if (pgdat) - spin_unlock_irq(&pgdat->lruvec.lru_lock); - pgdat = pagepgdat; - spin_lock_irq(&pgdat->lruvec.lru_lock); + if (lruvec != locked_lruvec) { + if (locked_lruvec) + spin_unlock_irq(&locked_lruvec->lru_lock); + locked_lruvec = lruvec; + spin_lock_irq(&lruvec->lru_lock); + sync_lruvec_pgdat(lruvec, pgdat); } - lruvec = mem_cgroup_page_lruvec(page, pgdat); if (!PageLRU(page) || !PageUnevictable(page)) continue; @@ -4282,10 +4282,10 @@ void check_move_unevictable_pages(struct pagevec *pvec) } } - if (pgdat) { + if (locked_lruvec) { __count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued); __count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned); - spin_unlock_irq(&pgdat->lruvec.lru_lock); + spin_unlock_irq(&locked_lruvec->lru_lock); } } EXPORT_SYMBOL_GPL(check_move_unevictable_pages);