Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3824654ybl; Tue, 20 Aug 2019 02:52:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcr7TAk3A71cnF8uHUwUDu3DXPL827cSTLgOrBudjwd/wh0sooQGtOjTUalIWHhX1LEmeu X-Received: by 2002:a65:5584:: with SMTP id j4mr23779633pgs.258.1566294743536; Tue, 20 Aug 2019 02:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566294743; cv=none; d=google.com; s=arc-20160816; b=xeqfG/scp5co7j0Epld+VlqmszqvPZdCXPrsyRShf+HtMgeSUunwCbFrI99Aa41Z27 HL1oSqWGvQ6IQ0IGOgKC7r7ElTi0TmKVhTdYSlKhGBPEl91vWEsFfz65YMfhLZ4JFXaX UVtUicacZnqXSBmZJmqwks4DrwfnlbvI6bDjL8/oan6ZA5JrHTaj3/nj9vv1jR8LT5JX AzL7DdZ5PGeirqvKoRfriS2nIyTfONdWjzuaEAIeIChI34FPlcMldncDU6mp9taXEU73 izuRgDKg5gp7JbhZ6/U+lZDh18r8SErkKchPGRqSxOmrnQOyOjumS/HMGXo4ZQRu9COy 4qGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=3U3CVyvNvGdgZgiqjYk0Qc+IXZc/eTKWAyIsF9pu3a4=; b=HmTnvys/rpiVjbhZEzK9diyf/tP7EseaMl/Q02HMIQWsSxfoJ33dqjyVj3MHaDKCin lPhm0b/HTyX2T+AwPD85ACQZPpYCuap9CnKK4ZS7Uhe2khwAGpc7ATWr3fQaJDeh47b6 0ANVQx0aYmFifai5gn7EjijVmquizrrhWvKOyBZZmaOW47G5ocqW3KKBdEeGyc8gAz2C KjVmLNy/8H54/E3GbPAwWFxW0EiKZmqJjgst8HcTw+5GRT1SymFPBilGXZ7cu/Qf33rl Fh/+USroNRs6RixQtmumpvx+6R1eHfZwiPVgW2/QNFuKMtCF18dDMYwRunyNHxcJvFOZ Pg6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h24si10808413pju.97.2019.08.20.02.52.08; Tue, 20 Aug 2019 02:52:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729887AbfHTJur (ORCPT + 99 others); Tue, 20 Aug 2019 05:50:47 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:43153 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbfHTJuq (ORCPT ); Tue, 20 Aug 2019 05:50:46 -0400 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 1.8.3.1