Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1350351rwb; Tue, 29 Nov 2022 12:18:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6uNrdXBdZ6wo2nOIb2Y/EyRdgYKmkh+/OAn85juHLk44UqZXapPk7Sy5v5oGNlfbWEt3IJ X-Received: by 2002:a17:906:2404:b0:7ad:d411:30af with SMTP id z4-20020a170906240400b007add41130afmr6505054eja.636.1669753130129; Tue, 29 Nov 2022 12:18:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669753130; cv=none; d=google.com; s=arc-20160816; b=ZxAvov/mE5M7mUWkLpR581J5NgdwcsAaKEHKabJmYtG8xq3dtcCpHGlKK9X4f41nSE Yvj+I3BQy24L4537NmWEBmSsOS6BdxKKC4LzDwmBkWJU544NhA8wOOivom3quLiEqAs/ g57LTyjCcHEoP94RjZfS1wKbmWHslNlgs4aFDQSm5ThV9c5CPuTd72C70sPtKw1n77jT eVhhXNHFxvQ2WLN5kz4mxcsRvNkzL9BibDcXqNP2crMiYBqSSNWoxf+5E2yCSgiLzJSx MOBCJEkbiGbwQ2Q+SAbnxM3CkB1l7s0t6Ghckzij/6TJv8yssxqkQ3GXAtPloHLcDFQW BKnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rGTIG8x4KsRIPh4QmKAiIuwOVCN06VOhOfE/clNYHVU=; b=BrzQKJLMsPdl/7U8HJbohO32EY/QbNLqGtHQ77I2rqWa9Mn+TgbYDkCZEqouSN2jxg TN/ZIviVQ+PVoL8+0dmW4TevLxLKLIcQpvcUzjeqodxzjq2j10N2O2SU2ghPq5wJ/vqB LgndqX3WH52jE/5K4i7fo9eoM3Wd4UrLCiBhJZDpSAhtsq7BIJL329SuokST7CBfjDRk HneTsAw3zrR+RciUgzhuXHZFgIIzyOxH7kWDpanDnhi4zaJLCq3HbqM4Q8rwsq836aIc ztxWOF2xUNfGu+YOwDtfYtes9his5nriti6QUjQ9hd6d78ZY8ll2vCef1ffRohCEwROK 9Z3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iCbO4c3I; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a17090606d500b0078dd12d0a9bsi10423105ejb.875.2022.11.29.12.18.29; Tue, 29 Nov 2022 12:18: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=@google.com header.s=20210112 header.b=iCbO4c3I; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234834AbiK2Trg (ORCPT + 84 others); Tue, 29 Nov 2022 14:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236277AbiK2Tqr (ORCPT ); Tue, 29 Nov 2022 14:46:47 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA6177205 for ; Tue, 29 Nov 2022 11:43:06 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id y83so18837267yby.12 for ; Tue, 29 Nov 2022 11:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rGTIG8x4KsRIPh4QmKAiIuwOVCN06VOhOfE/clNYHVU=; b=iCbO4c3ISsWAsryVLUOqcvzYLYwMoYxQScIi5QhG+vvlujDo7VmIfHe0IA52ZQutMK amwKaZjJTL6PsYXcJVsqFVkIuQuyfovT0EWhapOAzn55PBiHbsC7HdJwIyN7CT9cHI8x VVZ7qVmQsKNXg3E+ebb0Guqg0H9F0i7pEexuw4OPdde3Ed8SN8zyNmPjSnSHOukHyEji kacPnsnMaugQ7P40hIuhkUOARS0JEquiN/xd2Hs8T1HKzZZSa7CNXyUSZaMrgWMBJVZL w7tgyMF7w6NMxVOxYy7wSc/DUJxU6gOhmqnNLv9/F87H2osfOzzasLTlcfRsHXVbcWTx 9MaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rGTIG8x4KsRIPh4QmKAiIuwOVCN06VOhOfE/clNYHVU=; b=UHp1yBopCWBssfH2IgVe2iemAGnC1HIkFd6PoeQko7KbR8/RjmUmtfC5QVgzXqrSGf 1rQE0i8tDnbW7s0Xa78FBU20tfDkYF0G78maDSsBoQEJ09j1Egk6kuza9E2azQXlZTUf 2HqTgVQslQZ3Qx3Auk4CYTb/SnTQWF/9h7hhZY7einqz71pXVGtJZXXv4iMe+T9Y07nN 5a3Fy/QlG+QWWom+7BRpUFvVoquzXH6+nYDQmHvpXMACkNvOefRNwVeVZRht8vXwufcF ikU5wR+Fg9kTAVQuNYWHg1J7DQssVhIoyDOZ41olCvuiALCU7D1CWXsos54QZv8vLOYc ACSw== X-Gm-Message-State: ANoB5pmPDEGH5dIokEkeQyZa6QakYKd5jyPyK9rLgUYAHbZrA9FiiNOr rtbyPseA0j4Ekw6NG/QeMocq7IuTEhG5uj/DRoYPsg== X-Received: by 2002:a25:909:0:b0:6f6:e111:a9ec with SMTP id 9-20020a250909000000b006f6e111a9ecmr10937713ybj.259.1669750986030; Tue, 29 Nov 2022 11:43:06 -0800 (PST) MIME-Version: 1.0 References: <20221123181838.1373440-1-hannes@cmpxchg.org> <16dd09c-bb6c-6058-2b3-7559b5aefe9@google.com> In-Reply-To: From: Shakeel Butt Date: Tue, 29 Nov 2022 11:42:54 -0800 Message-ID: Subject: Re: [PATCH] mm: remove lock_page_memcg() from rmap To: Johannes Weiner Cc: Hugh Dickins , Andrew Morton , Linus Torvalds , Michal Hocko , Stephen Rothwell , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Tue, Nov 29, 2022 at 11:08 AM Johannes Weiner wrote: > > 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? I am on-board.