Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4642083rwb; Mon, 21 Nov 2022 09:59:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pSVV/JJL+mbLCwJGZiN8AapCcBL0wEFEqriH7AtuGwSguS5rOQOQOwo485V6dh0QrM5ds X-Received: by 2002:a05:6402:1a59:b0:469:2dd9:b7c1 with SMTP id bf25-20020a0564021a5900b004692dd9b7c1mr12381696edb.292.1669053567149; Mon, 21 Nov 2022 09:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669053567; cv=none; d=google.com; s=arc-20160816; b=nzBeFUv9qPZkrZbp550oaH9GqUYXau2zCKZxYURbGLxkrQOtqP5tsoDakg92ArDwFK C1sO2OKYx721bOsg9LoHciV+u18MVkwVoP3hYF9UzpY8n0wxGQHDDC3sCLXQHUa3F9b7 JZGZ5n+s95q6aBUjk1B2Lx8LWcTTFVp2x36+d87jb2wGVYwyzQXfp4fbzHAZW0YssFAI iBOVLyeYJ5S6I0LIJYiqedzGjY8e/TafPjA+CDL1qH2QAzTUXnYKi6H59EUIlgYS81Ip VdZ3IUKCnk1pljPl4PUrPldvmBaWOml7f3ka1V76uf6j+I8in4CVhN726U+h0lTnE7Oc q19w== 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=i/VbYzsnoDE2k0Jj4uL/vSZLNIjl3EQx0mm05ELH+/A=; b=UNWuvXSZJXm8RvRKvOAun+ljdcgdqWPfo3ZXh2foBDmR+eI0CCxpsW3NrnBl2b8vth ulGnVBgUeAfJPoKgQhJ9V0XTok/q4osRjsekktZ2dM+Z3GrUahl442Hkz8aMP/du2pTX YjoyEfJ2ku1ZxPtgR6B/3FWLrKhsynDOuheL214eOFp/QhUBFW6omjwUtj7tKXT5SK6Z wDOp4+cRT8rH8nqcFtDiiT+J01gVBbTE5aipZQdUql8H8XXPaSOjUPiUkoUbMKfjdVf7 wgXyqFTU0uFkInO1FofyM21gYsjw6STW8180kUhkrzT7ta5z4C7em0Mn9ozLNtoiGu9W Yv4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SvPg1Ztv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg13-20020a170907a40d00b007ae4ed48290si11441499ejc.279.2022.11.21.09.59.04; Mon, 21 Nov 2022 09:59:27 -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=@linux-foundation.org header.s=google header.b=SvPg1Ztv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229669AbiKURYA (ORCPT + 91 others); Mon, 21 Nov 2022 12:24:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiKURXt (ORCPT ); Mon, 21 Nov 2022 12:23:49 -0500 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0195BB6E for ; Mon, 21 Nov 2022 09:23:49 -0800 (PST) Received: by mail-qv1-xf30.google.com with SMTP id h7so7841840qvs.3 for ; Mon, 21 Nov 2022 09:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=i/VbYzsnoDE2k0Jj4uL/vSZLNIjl3EQx0mm05ELH+/A=; b=SvPg1Ztvqfsah6gG0PV9vXMlY7b7QctK404v8Y3iQFhXamQOz8sDneWIPMDDajhp1i G9aPIymQ8yfBh+kzb/C8LfxfF5LgGKVHzuHFr6c96/J/nLydPegcrikWa8Sl9y/aXbPO YYxBcHwur972W656iStWTcS4nNFTfczO0mRjk= 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=i/VbYzsnoDE2k0Jj4uL/vSZLNIjl3EQx0mm05ELH+/A=; b=absO4sPh1TXtUzhDaCFDChlaFdK0CeivJj5pTxhDS0B8O2Vp0DbFd9X5lU8qpIoSb9 rzT5vdaI0rvttieFGOpKHIpJyHUnR/rbODSWrp/wD1WLN3eIHK+ce0oG6Pa5Doh8FjFK YzYbzMSSIl4BncT3WyALxNlaCglpQSCN9iOxBGhN3DLa0QBZnCrON5E3Up+Sg2rMzGD4 lVKbKse6x0lr1odg7A4Q7L8+DFoVUfsXBQVRNK15OEb6GaH7I8ZNhE12Fk/y5879RH8E Urwfh03xMYPMld7iH2DerwrcLTm4UMP6Y0dWCsYRb1c44pRX4/NwW1GOaLm8tbZ+hv9T VHYw== X-Gm-Message-State: ANoB5pn/pFBvMiT+wMfCYcuh0NmprIp7jJHtu6yARL7NXOz6YKy335C3 feBLKj32zBBNpQnmBT+iAcWuTyLAUIviXg== X-Received: by 2002:a05:6214:3d8a:b0:4b1:c5bb:25f2 with SMTP id om10-20020a0562143d8a00b004b1c5bb25f2mr3108084qvb.101.1669051427777; Mon, 21 Nov 2022 09:23:47 -0800 (PST) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com. [209.85.222.178]) by smtp.gmail.com with ESMTPSA id ay34-20020a05620a17a200b006b929a56a2bsm8560346qkb.3.2022.11.21.09.23.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Nov 2022 09:23:47 -0800 (PST) Received: by mail-qk1-f178.google.com with SMTP id x18so8485296qki.4 for ; Mon, 21 Nov 2022 09:23:47 -0800 (PST) X-Received: by 2002:ac8:41cd:0:b0:3a5:1ba7:717d with SMTP id o13-20020ac841cd000000b003a51ba7717dmr18464445qtm.678.1669051034241; Mon, 21 Nov 2022 09:17:14 -0800 (PST) MIME-Version: 1.0 References: <5f52de70-975-e94f-f141-543765736181@google.com> <20221121165938.oid3pemsfkaeq3ws@google.com> In-Reply-To: <20221121165938.oid3pemsfkaeq3ws@google.com> From: Linus Torvalds Date: Mon, 21 Nov 2022 09:16:58 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] mm,thp,rmap: rework the use of subpages_mapcount To: Shakeel Butt Cc: Hugh Dickins , Andrew Morton , Johannes Weiner , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Vlastimil Babka , Peter Xu , Yang Shi , John Hubbard , Mike Kravetz , Sidhartha Kumar , Muchun Song , Miaohe Lin , Naoya Horiguchi , Mina Almasry , James Houghton , "Zach O'Keefe" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 21, 2022 at 8:59 AM Shakeel Butt wrote: > > Is there a plan to remove lock_page_memcg() altogether which I missed? I > am planning to make lock_page_memcg() a nop for cgroup-v2 (as it shows > up in the perf profile on exit path) Yay. It seems I'm not the only one hating it. > but if we are removing it then I should just wait. Well, I think Johannes was saying that at least the case I disliked (the rmap removal from the page table tear-down - I strongly suspect it's the one you're seeing on your perf profile too) can be removed entirely as long as it's done under the page table lock (which my final version of the rmap delaying still was). See https://lore.kernel.org/all/Y2llcRiDLHc2kg%2FN@cmpxchg.org/ for his preliminary patch. That said, if you have some patch to make it a no-op for _other_ reasons, and could be done away with _entirely_ (not just for rmap), then that would be even better. I am not a fan of that lock in general, but in the teardown rmap path it's actively horrifying because it is taken one page at a time. So it's taken a *lot* (although you might not see it if all you run is long-running benchmarks - it's mainly the "run lots of small scripts that really hits it). The reason it seems to be so horrifyingly noticeable on the exit path is that the fork() side already does the rmap stuff (mainly __page_dup_rmap()) _without_ having to do the lock_page_memcg() dance. So I really hate that lock. It's completely inconsistent, and it all feels very wrong. It seemed entirely pointless when I was looking at the rmap removal path for a single page. The fact that both you and Johannes seem to be more than ready to just remove it makes me much happier, because I've never actually known the memcg code enough to do anything about my simmering hatred. Linus