From patchwork Fri Jul 3 05:07:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 11640855 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 2D061912 for ; Fri, 3 Jul 2020 05:08:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 04267208FE for ; Fri, 3 Jul 2020 05:08:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04267208FE 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 A54B58D0041; Fri, 3 Jul 2020 01:08:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 98D0D8D0049; Fri, 3 Jul 2020 01:08:43 -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 7E2F28D0041; Fri, 3 Jul 2020 01:08:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 43BD78D0049 for ; Fri, 3 Jul 2020 01:08:43 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0990C181AC9C6 for ; Fri, 3 Jul 2020 05:08:43 +0000 (UTC) X-FDA: 76995584526.21.title38_1a000d826e8f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id D71EA180442C0 for ; Fri, 3 Jul 2020 05:08:42 +0000 (UTC) X-Spam-Summary: 1,0,0,a8794f352de5c57a,d41d8cd98f00b204,alex.shi@linux.alibaba.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1345:1359:1381:1431:1437:1534:1542:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3308:3353:3867:3872:4321:4605:5007:6261:6737:7903:8957:9592:10004:11026:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13846:14096:14181:14394:14721:14915:21060:21080:21451:21627:21740:30054,0,RBL:115.124.30.45:@linux.alibaba.com:.lbl8.mailshell.net-64.201.201.201 62.20.2.100;04y8b5x66q3wkc375d137s477op7qypcfki7xotwwxm15j8ai9r1rnoc5zswiwy.r69bnirmb8rf33dccu85xm4m7dcb3jw1ft9z7f7a8h5p4si4u91tqqrs5bz5fhw.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:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: title38_1a000d826e8f X-Filterd-Recvd-Size: 3962 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jul 2020 05:08:41 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0U1Y4LGX_1593752912; Received: from alexshi-test.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U1Y4LGX_1593752912) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Jul 2020 13:08:37 +0800 From: Alex Shi To: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com Subject: [PATCH v14 10/20] mm/lru: move lru_lock holding in func lru_note_cost_page Date: Fri, 3 Jul 2020 13:07:43 +0800 Message-Id: <1593752873-4493-11-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1593752873-4493-1-git-send-email-alex.shi@linux.alibaba.com> References: <1593752873-4493-1-git-send-email-alex.shi@linux.alibaba.com> X-Rspamd-Queue-Id: D71EA180442C0 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: It's a clean up patch w/o function changes. Signed-off-by: Alex Shi Cc: Johannes Weiner Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/memory.c | 3 --- mm/swap.c | 2 ++ mm/swap_state.c | 2 -- mm/workingset.c | 2 -- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 87ec87cdc1ff..dafc5585517e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3150,10 +3150,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) * XXX: Move to lru_cache_add() when it * supports new vs putback */ - spin_lock_irq(&page_pgdat(page)->lru_lock); lru_note_cost_page(page); - spin_unlock_irq(&page_pgdat(page)->lru_lock); - lru_cache_add(page); swap_readpage(page, true); } diff --git a/mm/swap.c b/mm/swap.c index dc8b02cdddcb..b88ca630db70 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -298,8 +298,10 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages) void lru_note_cost_page(struct page *page) { + spin_lock_irq(&page_pgdat(page)->lru_lock); lru_note_cost(mem_cgroup_page_lruvec(page, page_pgdat(page)), page_is_file_lru(page), hpage_nr_pages(page)); + spin_unlock_irq(&page_pgdat(page)->lru_lock); } static void __activate_page(struct page *page, struct lruvec *lruvec) diff --git a/mm/swap_state.c b/mm/swap_state.c index 05889e8e3c97..080be52db6a8 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -440,9 +440,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, } /* XXX: Move to lru_cache_add() when it supports new vs putback */ - spin_lock_irq(&page_pgdat(page)->lru_lock); lru_note_cost_page(page); - spin_unlock_irq(&page_pgdat(page)->lru_lock); /* Caller will initiate read into locked page */ SetPageWorkingset(page); diff --git a/mm/workingset.c b/mm/workingset.c index 50b7937bab32..337d5b9ad132 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -372,9 +372,7 @@ void workingset_refault(struct page *page, void *shadow) if (workingset) { SetPageWorkingset(page); /* XXX: Move to lru_cache_add() when it supports new vs putback */ - spin_lock_irq(&page_pgdat(page)->lru_lock); lru_note_cost_page(page); - spin_unlock_irq(&page_pgdat(page)->lru_lock); inc_lruvec_state(lruvec, WORKINGSET_RESTORE); } out: