Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3354662pxx; Mon, 2 Nov 2020 06:51:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdpqQ4cfTPcrX6Q7sm31JsW8l4RpCwEFNHOTtba74tQQ6vS2olhoM4HZ4nNTQAhnLoZ/Bf X-Received: by 2002:aa7:cd56:: with SMTP id v22mr17384763edw.245.1604328712276; Mon, 02 Nov 2020 06:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604328712; cv=none; d=google.com; s=arc-20160816; b=uVRi8o6719TZDY1En7eDoSvmGpveknpFutgbNKiGQwG0cIu0rNaXbAzREyTVXDE7RH 7u7obXDts46vfS7nvSVku6DklohgimdLal/mApgYXKt2fe6uC24raDZyqOY/OgxXykxO wvb3t9/0de8ONk6O07vHW7l1wzAl94GlIg7eg2klfvF9BjJCSOI6l3PZ8CsFjd4oQlwE q7Vmx5gFQVUnBuTkzdQ8ls/yJkuSnY4wyNbkyWV7BxEMkI4NtRYncSa6C3TBpUFEX7OH j3Y+04SovVt3J3R5DysceP6IP2Mpe/k8F0zyN5VBnmTmBv8EeVuDUruSjilV4AWmtRjV cIqw== 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=9Y50BuvtY/Iv9iX09V09H3tcMOFeUq4GX0ITyW7hR88=; b=EM/KWKek8KSsz25cQP5TXsP5T2bTySfVmMDJIAh9Vhci/G0waKBsM9P0+FFuKYoIhl mX7YHkF24NeYhUal/13EB7sRde8ZmYP7isCVvEZwoZ8Dh0hbZd+Y0U1FDVwK0nyyw5aU h1/9uotzjgjnVOhtgXM+xo1+Ohho/6K2fbBeFxD26ivlTJFmioLKAi9kf8oi6uOX9KNU yWyCdhdkiELF1ztiocNUw3JDEUXd9IPUQcImpyb/jnNhaBQLPNE91aVGS6F6Uho5DA0y Ofc7GBjWeGt5JJt+AcpWwK9JlXSgw6cAadcmFdG+Wec64RlHCzlyNa4c/nMjiqEYNI4f Xasg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Fc5EzzbP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si10980071edu.247.2020.11.02.06.51.28; Mon, 02 Nov 2020 06:51:52 -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=@infradead.org header.s=casper.20170209 header.b=Fc5EzzbP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbgKBOtt (ORCPT + 99 others); Mon, 2 Nov 2020 09:49:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726016AbgKBOts (ORCPT ); Mon, 2 Nov 2020 09:49:48 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95849C0617A6; Mon, 2 Nov 2020 06:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9Y50BuvtY/Iv9iX09V09H3tcMOFeUq4GX0ITyW7hR88=; b=Fc5EzzbP5uGjYagLwVWe4N7rSc dT4LPqKUJQefMq0cWg6QZxnZyzdW0BT/rLNPNmIIzGjo6rnnJx/uNQnCaukD43QfeUz4egAOUJTEN EsUPSMhMJLUgnontgXLVFf1k9EJkUYkC4BpE+14S9u/W8QEbfXOis468N/nX2cczNVhkRsKScXYHY tpj4XWjN+CWDGuX9qefNrodCFBeuiTggLV5g0NTk4c+wGg7MWemnx0Wt1qSxG5lpOvgIFJITFzZ80 DB3MVpy1gEYCxw9T6tPp5HHxTX30xlGavqhM697UTSooTwW0jmx5PcZIOUmXva0C6VNnW2SiHnAfe ROmfwCBA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZb9D-0007ZT-TK; Mon, 02 Nov 2020 14:49:28 +0000 Date: Mon, 2 Nov 2020 14:49:27 +0000 From: Matthew Wilcox To: Johannes Weiner Cc: Alex Shi , akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, 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: <20201102144927.GN27442@casper.infradead.org> References: <1603968305-8026-1-git-send-email-alex.shi@linux.alibaba.com> <1603968305-8026-9-git-send-email-alex.shi@linux.alibaba.com> <20201102144110.GB724984@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201102144110.GB724984@cmpxchg.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 02, 2020 at 09:41:10AM -0500, Johannes Weiner wrote: > 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? I don't think it can point to an anon_vma without the ANON bit set. Minchan's concern in that email was that it might still be NULL.