Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1281112rwb; Tue, 29 Nov 2022 11:15:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf67CL2Tyrz1Gpy/H0HGmS5mIIAD6ErVUkxgse6I+5ex4EO1AtiWnTivNOZTAehLLzMSz/w5 X-Received: by 2002:a05:6402:1013:b0:463:f3a:32ce with SMTP id c19-20020a056402101300b004630f3a32cemr37287342edu.366.1669749350887; Tue, 29 Nov 2022 11:15:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749350; cv=none; d=google.com; s=arc-20160816; b=CUPk1s7Z0b/PZ3uoCvZ6wN2QoDKjYhjV+/VXw4fAiYZX9AjIKR/Mhd2tcTCuTqtfOo SBDkzyk77+xkUTUYrfooxrsy/+kLEa12tWDIrROhljWrFF8ixaOnbvWpc0Kzl4qJFDlZ WhnCDKx5pmqdWI71BUzYj7IGFkTFKpscfKDcIpPV4VY81vpzWWaSZ0MpI3pnH2Orv8Dn +HcnGUKrsfu+VWue2pSw58uWgvcS0VbNCBvT8Tp/BuMcJZxDemvSGChTtHPTgYjWOjRC omFyedFppJ5q8A9Hbxxy7KF8VM71G8aqoiChoOE7RS/ZpIxiAdYdcYx0KEkQSFIhdja6 dVLg== 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=QmXXccF6gcyyJcn8xYpOax7l00RlE3WtMYxosINrpmo=; b=atg2rSpv2KPdK+4t3PhFEaBorSY44VX6aB8mJqdrOq2A9VHBiHLvf56tUE+SdHi3pE mInSAiHrgAwEVPE5gwzu+L8CuBFzEC2qTrw+n6LyPiZ73kwuOyirItshyR/Jjp+AU3Hl rRLMLYKkdEDTBwf5CqYK7KS1YM5f7GgetkVwVZ3STfmGM1tYgXmxn2XG5NE+wZe2yS3Z A0aIVH21CAMjQ6wCRqJRpMz7N5tFcxe8L3P3dskP+JYHTkaSHn/nYvd0RQQpXHghBT9c lJ1H/ppXhTJAjozkAnKfi28ssIM9ckXA6W1lbW+88upjsc9VcLvc/p0vFzseDHl1NH1I fPAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=1kG96GwD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp42-20020a1709073e2a00b007878144285csi13233864ejc.314.2022.11.29.11.15.25; Tue, 29 Nov 2022 11:15:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=1kG96GwD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236422AbiK2TIl (ORCPT + 84 others); Tue, 29 Nov 2022 14:08:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236351AbiK2TIi (ORCPT ); Tue, 29 Nov 2022 14:08:38 -0500 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCA0E537F1 for ; Tue, 29 Nov 2022 11:08:36 -0800 (PST) Received: by mail-qv1-xf2d.google.com with SMTP id n12so10380003qvr.11 for ; Tue, 29 Nov 2022 11:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QmXXccF6gcyyJcn8xYpOax7l00RlE3WtMYxosINrpmo=; b=1kG96GwDm4z4tl5X58tMTSiaw3DnpfdCF/rv7UlXbsY8+W8PnZuGywUo6KHIprE3/m C3/GaQpilxnGQceURvNXTO1ziGUJq4Vc2aq7zP10STkI1U+qpHo7fv8DPSjq5nmE6ZDr C650xqNqffQvPC+Elo1PQXQrtus8NaS/ki4zN58D+ZaxSNRC+Vtxehlx8iQIVmXaEnyn dXr1dJoOKIVqUhDcSoGHaKX3y65ZqZegji+EglMCsAv+k1m5HXwK3Hflzhq4HrxtID2A PruXnlCS3Ni2PLeN/PPbY1Pqv87aHsLGz+Av6nyMfMl+F8m8jTAKXsXDZ+jBt1Cs+Aaf UU7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QmXXccF6gcyyJcn8xYpOax7l00RlE3WtMYxosINrpmo=; b=shlAfrWa/9BuSZgD+/CRQ25OOGo8BVVrHdPQEjT9OpJuYR60aE/QAtYZHruDX9fIVa GKDJrQcJeSNPOeh54zpKKV5Tq9XH+jGFhkcTZEfQpYxzgbr5etEJL7KLR/zUIxPs09Nt yCW0cki1KQ7FvybQrxAxXS95g0JaGWY2KhhjRdTIF3cwmMt/wNQeA4uaPD3EfjakSCvT MYya/ThYU+mQ2o24XldnZZ3mqhmwGXATdh52Zz+DRYDt7fcKy2kVSW1Kv8Na4/a8F2hO 1cO5yGjdjIXaQy6eR3kBSqErbXVGOHDpkdhjuexE3ZgMRJJiBChYYGkcwN/VZ6PsULeu KZSQ== X-Gm-Message-State: ANoB5pm2WxmY4OBrE4p/pVZICTXPNNAKLX/yl9yXvF0qoMOMTyJk3ER3 bdu/UvHKqStOzE296WZ/DYpxDUvGZ7DKUA== X-Received: by 2002:a05:6214:3612:b0:4c6:e2b4:8c6c with SMTP id nv18-20020a056214361200b004c6e2b48c6cmr22819440qvb.13.1669748915997; Tue, 29 Nov 2022 11:08:35 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:ea9a]) by smtp.gmail.com with ESMTPSA id w23-20020ae9e517000000b006f9f3c0c63csm10841129qkf.32.2022.11.29.11.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 11:08:35 -0800 (PST) Date: Tue, 29 Nov 2022 14:08:34 -0500 From: Johannes Weiner To: Hugh Dickins Cc: Andrew Morton , Linus Torvalds , Shakeel Butt , Michal Hocko , Stephen Rothwell , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: remove lock_page_memcg() from rmap Message-ID: References: <20221123181838.1373440-1-hannes@cmpxchg.org> <16dd09c-bb6c-6058-2b3-7559b5aefe9@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 28, 2022 at 11:59:53AM -0500, Johannes Weiner wrote: > On Wed, Nov 23, 2022 at 10:03:00PM -0800, Hugh Dickins wrote: > The swapcache/pagecache bit was a brainfart. We acquire the folio lock > in move_account(), which would lock out concurrent faults. If it's not > mapped, I don't see how it could become mapped behind our backs. But > we do need to be prepared for it to be unmapped. Welp, that doesn't protect us from the inverse, where the page is mapped elsewhere and the other ptes are going away. So this won't be enough, unfortunately. > > Does that mean that we just have to reinstate the folio_mapped() checks > > in mm/memcontrol.c i.e. revert all mm/memcontrol.c changes from the > > commit? Or does it invalidate the whole project to remove > > lock_page_memcg() from mm/rmap.c? Short of further restricting the pages that can be moved, I don't see how we can get rid of the cgroup locks in rmap after all. :( We can try limiting move candidates to present ptes. But maybe it's indeed time to deprecate the legacy charge moving altogether, and get rid of the entire complication. Hugh, Shakeel, Michal, what do you think?