Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3350617pxx; Mon, 2 Nov 2020 06:45:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6CeehbM1iwgxLiX4umz79CbnXz4PKjMWmNzkYecNj4wnJW3ihdL16eFLOJcLdCwd742Dr X-Received: by 2002:a17:906:2850:: with SMTP id s16mr16189649ejc.276.1604328304912; Mon, 02 Nov 2020 06:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604328304; cv=none; d=google.com; s=arc-20160816; b=XRd0Y6P1nOCWK9nxqa0llMFA9q0XpwlywZaqBUbYObXhtxQAjiicAN5M3LdUfxLQm5 jJuqfv8uUzmvVvAojuY50r6vIfWPJEDYaWeL6SOuqJbY+4tdTdYdOIwzamKL5WC92Fry jnmSDX7KQTsqMUwdhXBZoW5HyxKhn9F8tXyEUeFSSzph8/krl6BBRQeV81Ul1NRxXxaP R5ioEPDtxzfWpcb2JIrkS7SbEyeS6narz4YtacovUSeX29SsjiUFuLLRNJ62caUsLdec SAd7te0mOSp2BK2y1QySkmADEC03VjZm3mDZS02Etc2rQC60qMWg9JOqdcPJDVi2bphv yNNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EFQY01EyQEOZuxyO/m/7TxD1TS0aUUa0gmanbTdmHu4=; b=oORUlf1Wq7R72IAY6ze3r6wAIoFV+h/m3gNyHDyjZvVenVMvzKLI2GWl9c7L6eRNeW pogG41jzhwT72SPJPYMn/0V92XGvOdnzhhRBRHJlw2FEpHCALTpvqLu1miQbKoLvX+5F /t4milNWUXDUYCsObxblmJgp1zdUVv+wjK5MiCM/Zv9tK7k+PC8VovN7Q6nBzLvo1e7i dgGitlLbWRzfz/4+O0CUmSsMfnQ+/DsXdkfa1WdhsgsfP19jVbJ8etAzmr2V/qG/mxDW bwpR0YJQM2kQaj0T8pLYZTSSIbmIvCso32P4SpsHnZUdilbHprV9UaWKjHxY3tszOiZb 4oxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Wz2IE1DQ; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si8545141edq.470.2020.11.02.06.44.42; Mon, 02 Nov 2020 06:45:04 -0800 (PST) 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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Wz2IE1DQ; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725941AbgKBOm6 (ORCPT + 99 others); Mon, 2 Nov 2020 09:42:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbgKBOm5 (ORCPT ); Mon, 2 Nov 2020 09:42:57 -0500 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DFEBC061A04 for ; Mon, 2 Nov 2020 06:42:57 -0800 (PST) Received: by mail-qk1-x742.google.com with SMTP id x20so11643226qkn.1 for ; Mon, 02 Nov 2020 06:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EFQY01EyQEOZuxyO/m/7TxD1TS0aUUa0gmanbTdmHu4=; b=Wz2IE1DQU+bCAzYFTSbwl/3Wdg8BO9G9iu5/96MzFSytj8SJW4UwXqN4SfmYHKcLOx nM7CFATxwP5AzIsJgj8OQjBdfw/OxeCZVvGXUBn1yyZyqAOxxH09/1QHD6qIvv1JBVSH D/PW0demiOmu01+v6nS60rKe2GrY9KDnsNqmI0kFgatG6ap1JznKEEFmPL8oNHaRXyoX DKdhKpLRg/vG8Q+wr1G6mF+IWnI4SbUsqpGlOwvoZZwWAJa5An0gnBPWj80C0qSGVQNn uHTTWyqvbSO6YmINQgzFwu9Xs09qPxjAJ4JEzdHCyrZlfA8vOM+NtagPK1hXbqgk9+fR TO1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EFQY01EyQEOZuxyO/m/7TxD1TS0aUUa0gmanbTdmHu4=; b=KRiXU4x2dXhNvws9jF5Tjf2GVIDngG0Y/b8rsKNpPkSg0YCWzonK25eM6OXkO2ezMz 6YMZQIEBjEJzpRbd73akc4z3Fp/BHAmGL46JRTuGqamkptSm1o0MyxtoGTl7ZCZ/MZwm at6pwCOlCDwS22oNYmSCBqWE7wg71HtRw1aJIjxQ9JNH4dHJ5RggERnzdT8HbxS9dXSV yUQq8TYDDuwxUg/BzkHg/7GsqDDH7D2wwm+mBzfFUCFAOxna+Lv0UX6UpQujdOwUEgL3 TjbdkigweqjjVm+Jm+4R004DFyEOV0reH7wxTupogtN48IULKcGJSJ83Lj5iSorFvtl0 +yLA== X-Gm-Message-State: AOAM530lZ0NYr1ybwXmITzuxf2TSrHA53P0tdX4rMdiHS8KRsmMJTEBt BZUPa+RwP7T997s3uia2PZTp/6inCL8ZEg== X-Received: by 2002:a05:620a:b97:: with SMTP id k23mr5141104qkh.214.1604328176845; Mon, 02 Nov 2020 06:42:56 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:2f6e]) by smtp.gmail.com with ESMTPSA id t60sm2608907qtd.65.2020.11.02.06.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 06:42:55 -0800 (PST) Date: Mon, 2 Nov 2020 09:41:10 -0500 From: Johannes Weiner To: Alex Shi Cc: 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, 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, Vlastimil Babka , Minchan Kim Subject: Re: [PATCH v20 08/20] mm: page_idle_get_page() does not need lru_lock Message-ID: <20201102144110.GB724984@cmpxchg.org> References: <1603968305-8026-1-git-send-email-alex.shi@linux.alibaba.com> <1603968305-8026-9-git-send-email-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1603968305-8026-9-git-send-email-alex.shi@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 06:44:53PM +0800, Alex Shi wrote: > 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(), That doesn't seem to be the case in Linus's or Andrew's tree. Am I missing a dependent patch series? > 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). Isn't it possible, as per Minchan's description, for page->mapping to point to a struct anon_vma without PAGE_MAPPING_ANON set, and rmap thinking it's looking at a struct address_space?