Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp13085pxk; Wed, 23 Sep 2020 20:33:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq7E/sbogV39pGUaijGVB5b1NSA7/qb+AgrSpbw1U4VT1SSrU8nK5ZJN4sVbpGPsCN4RRI X-Received: by 2002:aa7:c2d6:: with SMTP id m22mr2439822edp.311.1600918425477; Wed, 23 Sep 2020 20:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600918425; cv=none; d=google.com; s=arc-20160816; b=D52Fq4weWqDnZIUCh97BtVIwARRpc96SfySiMSJJqVd/wmqYbEAQ1Ew72QEBvx6R4m baeXXuxLYLhTEwgMSck6DqPDBk3yoFM21darL7jcABEXI4hKZcvFXrZPHGjKoH+2gQak P/MSkdUSrlJu7fOhMLlzdFGR7EcpWqYPDTBrgbrccP941DhaSHiMpTQ4VTEOGokTBtzy gKl59irzi6E6TR4UnCvOFcTCvgRXvJzzmhrkIAEW3QdoLN26AeBoSYLps7/IrpBgjrKm UzccVwtS69b5RLMQhLBlqe4YUMVx0crFWXo2+KqFWn/99hDuTJyBLxK2RBepYr6ElIY+ 9cpg== 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=bTtU5sWH2HGk6W84JIMCUAXzhNvkWo2j1nOucObJYhB4msS70k+6P6nah9/B+PkXXr KQXFTPNsSks5d/Ik0oPFfJny5rq/kZahWZYNKhOvokqkhXVznA9Uhu2io3/IVAfx3fry lsM++AJ+hMI0j1Z1jKeLBUjtHeVU+bfOOCT2NS2jo0+sVENOQCHyRdnGFn/wzAxrw38s OG5tahOWIOv/1bS79jx+7aIP9aLGLG/ynhY3wKJz3QkRE6ctJj9F3vdVCjTF2i3RGP0r QY9PwRKxO/nPfHy3eoW3ZWJNyNnlqSOEMqc4ap/cBT73e4XuF/AAQrGrlg2RO3aK0xhN Q2bg== 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 c21si1273450edw.18.2020.09.23.20.33.22; Wed, 23 Sep 2020 20:33:45 -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 S1727149AbgIXD3m (ORCPT + 99 others); Wed, 23 Sep 2020 23:29:42 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:58519 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbgIXD2s (ORCPT ); Wed, 23 Sep 2020 23:28:48 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=24;SR=0;TI=SMTPD_---0U9w0Ss1_1600918116; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U9w0Ss1_1600918116) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Sep 2020 11:28:40 +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, aaron.lwe@gmail.com Cc: Vlastimil Babka , Minchan Kim Subject: [PATCH v19 08/20] mm: page_idle_get_page() does not need lru_lock Date: Thu, 24 Sep 2020 11:28:23 +0800 Message-Id: <1600918115-22007-9-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600918115-22007-1-git-send-email-alex.shi@linux.alibaba.com> References: <1600918115-22007-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