Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp329482pxx; Thu, 29 Oct 2020 03:49:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK9xa5LhJemOdfyy4f7UvC2ZZmNgpbWrVgHWY2eEK1dCIAg963kE9eDmGgn/Od9stsg52z X-Received: by 2002:a17:906:3a8d:: with SMTP id y13mr3516547ejd.460.1603968563399; Thu, 29 Oct 2020 03:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603968563; cv=none; d=google.com; s=arc-20160816; b=vIXgJ9VQhAgwj8WWCzetp6mPOEIYhsJ8hVhHdnBf3+os/Xl2hDm45gGWEr/5oNQevB 3FwUDSfiHc4zUwcxaO3bMTUfD+RmoHcPwDnnz1OF70OvwQp0pcJn1iYtwE6OmKsaDAob iolo+dasWe+qB9T8K7ok648IuuxzM2PB0ej5k3asurCf2TDtfjqeLAxpy9jkdPeIhPbB YRxAXbZ8dPRgEoksG1chIKkYfc/8rix4tAIZ6vDYJaASQ4dTKlpXwUjwQiWKTR+e0VWh bdK6wnt268gOGQSIVjm9HbU7KJ+UNwtz/IkMrM3DJHaRpdp6ySjLX3gQaxrypnfaVrwL NcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=rTL53A4gMMW4kC5AQ5Ykm7aOxvSWx9NL4BBVxvnyYzA=; b=feqsKUQq1pKdbMEmW23IG3TM8LA1DiK2HfcDzAKikkkUX/aTV6mkP1RYbXQ9K6VWUy yT89C763Kdu/yjEoIzZGOfchWX4QnUG8mxG5pxby9w5NVAQe1MKgd3wSL1t2NMcwssSY JZZEgZrQI3DjhGgTBDlZgz35whIjC/2FminEvRm4RadApbH2pXA7rsYtzeZQ9AKP1qiV 67dUCto2YQxx3W8eUZ0Ek1V5sbrBoPLT5Z0UQ5aPFZfgUY8a7B2YbCoWXmZseYdgjHbG GVj9ppYF3o6COgc1ZTm445kGk3+UCdpA0KQ30EeMbb5+a6QwMG6SiuToNcb0ZEWBuIZt KPpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id me10si1453316ejb.753.2020.10.29.03.49.01; Thu, 29 Oct 2020 03:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727134AbgJ2Kqo (ORCPT + 99 others); Thu, 29 Oct 2020 06:46:44 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:47523 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbgJ2Kpg (ORCPT ); Thu, 29 Oct 2020 06:45:36 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R241e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=23;SR=0;TI=SMTPD_---0UDXwDyN_1603968328; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UDXwDyN_1603968328) by smtp.aliyun-inc.com(127.0.0.1); Thu, 29 Oct 2020 18:45:32 +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, 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, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com Cc: Vlastimil Babka , Minchan Kim Subject: [PATCH v20 08/20] mm: page_idle_get_page() does not need lru_lock Date: Thu, 29 Oct 2020 18:44:53 +0800 Message-Id: <1603968305-8026-9-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603968305-8026-1-git-send-email-alex.shi@linux.alibaba.com> References: <1603968305-8026-1-git-send-email-alex.shi@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins It is necessary for page_idle_get_page() to recheck PageLRU() after get_page_unless_zero(), but holding lru_lock around that serves no useful purpose, and adds to lru_lock contention: delete it. See https://lore.kernel.org/lkml/20150504031722.GA2768@blaptop for the discussion that led to lru_lock there; but __page_set_anon_rmap() now uses WRITE_ONCE(), and I see no other risk in page_idle_clear_pte_refs() using rmap_walk() (beyond the risk of racing PageAnon->PageKsm, mostly but not entirely prevented by page_count() check in ksm.c's write_protect_page(): that risk being shared with page_referenced() and not helped by lru_lock). Signed-off-by: Hugh Dickins Signed-off-by: Alex Shi Cc: Andrew Morton Cc: Vladimir Davydov Cc: Vlastimil Babka Cc: Minchan Kim Cc: Alex Shi Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/page_idle.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/page_idle.c b/mm/page_idle.c index 057c61df12db..64e5344a992c 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -32,19 +32,15 @@ static struct page *page_idle_get_page(unsigned long pfn) { struct page *page = pfn_to_online_page(pfn); - pg_data_t *pgdat; if (!page || !PageLRU(page) || !get_page_unless_zero(page)) return NULL; - pgdat = page_pgdat(page); - spin_lock_irq(&pgdat->lru_lock); if (unlikely(!PageLRU(page))) { put_page(page); page = NULL; } - spin_unlock_irq(&pgdat->lru_lock); return page; } -- 1.8.3.1