Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp677125rdg; Wed, 11 Oct 2023 02:18:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPL2wIOv7qY1CY2fo3gnmsLY9H1kF0V98U7wQkR6zEwWYInNYoQQvB4MoxOxSfsr4+NeMs X-Received: by 2002:a17:90b:33c6:b0:26d:49a0:2071 with SMTP id lk6-20020a17090b33c600b0026d49a02071mr28002176pjb.13.1697015883394; Wed, 11 Oct 2023 02:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697015883; cv=none; d=google.com; s=arc-20160816; b=B3yRDV3lR12QWepox0AvRehlNdWSCDhEJM4zUxZEsQYwYqIYt9PFKK6omx2RdhLDmP u8K6kI2zIbahvag6NQZDbvOfQ4LuNLZwoRVrjl5M5mDUu30wicgn5N6t7UsIoyBCn0p7 CZLjZ8sdLF4yynnm5BfcUaLslEiPcdKEcuH3olE60ueZuEa3NwUzkL0NQ7XaGOeQ8VbN 6Q+vG2WjSknXq64ufoeDGj8XyKipQtSr3x4r1jd5ggak+DqzV7KSVn3KC9HyVaJZrV9s MNUtrtmqSd8ITlVGYsTRIlF6v2UNcL6ImA9Tvbrcjut5oci++Iugm9Ik+hZPzECAAaSW 3o8A== 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=Y0ui4FIOXF4erofK3EEiBiXcu0Hxm1HMmxaKkqRWWBw=; fh=jiqCHnXq0fpsF+s6diiiQsFb2vi+Tvw6+SCe6tvs1lw=; b=EJiclKpw4YVNLy1LmCVv87881hi0vdycMKbN99dNVSWHJjC/4nputkwQHZ8o1/7fhE NcQrwKaA+l3dXx9/FiM61apqErrzI04LawATAJRZf1JZWluozmGrUQo0sNm7jgxCxcsT B1qTevALy8rxFl2EDPPvkF9DyB+MV5SubrKHkLVgb6WtG8lGH0LdZSM41V5cxhAvYEOC 3RziP0+ODCcy+/Ncg1gnKM5BwnDr5QWVXm61q7b3Mt15cyslO2XByMvON877aHO/5LvS DC4RgMicmLhvOC6ckaX//jDpaBfGKBqW3wmToPlcg/MSdBoOpdEJx2Pjx+UR7cH6iRY2 Tfhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wh8oxInp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h24-20020a17090aa89800b00274cf8042b6si1566952pjq.102.2023.10.11.02.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 02:18:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=wh8oxInp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4E0B680E4FC8; Wed, 11 Oct 2023 02:18:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345794AbjJKJRh (ORCPT + 99 others); Wed, 11 Oct 2023 05:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbjJKJRc (ORCPT ); Wed, 11 Oct 2023 05:17:32 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB60394 for ; Wed, 11 Oct 2023 02:17:31 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id 6a1803df08f44-66b024d26e2so6588286d6.0 for ; Wed, 11 Oct 2023 02:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697015851; x=1697620651; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Y0ui4FIOXF4erofK3EEiBiXcu0Hxm1HMmxaKkqRWWBw=; b=wh8oxInpFZtf6XXQiMQnRBsMtFbLoHpOZgY41h+uCfOcYjlAk+rwyA7EgR8X09IHXI al05NAmn5RT5CR7aCyx7mYSubWFrjnSyICRSOwGK9qeoBgVTXmFDo5gcModECI6w6yoh 62RVPOunDUPP9MWog3JCEBLziWNMJcZZcZhDLvOko1r4bJ1aCjCscfk5s17cIe1ln3P9 o/DgJA/V5gwbImmxr7A9Elum47fq6294BG+Bb5mMarLWuqkLLoj9SkiKqXJRi5KP0kHS x0979Y562zkSd1NUkseqfxSDZadZSZ+CVoaTNZBLwXPjOGCjsLzoWOXe5Ch2NOLmeA7/ 2SAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697015851; x=1697620651; 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=Y0ui4FIOXF4erofK3EEiBiXcu0Hxm1HMmxaKkqRWWBw=; b=Q6944EQyI/U2U1IKg3sV8tNNAZ9aEGxkObFmdCSB3WsjLsRr1feKMw7jTKF+m8YTDH QVXryzJCM1WiPmagAJ9rKP8jqmBg0shB8e+NZaH/KevWOZdQQSIbQ8y6poeFy/uziDHX bu/DBQk4hoerrkDa1ME0mjXcY05S8S9hrvOEWlxpslvz/1kBHfNa1krhTlZz6XgNXJLm G4guAokn11Yu2kQVsDC2Qm5/05jir7GN0MDShW+/TgQd95xwvDUsdUHe2834fpeNhxTX J/BdczEOw7tEdv4od6qTbu3+1bg7eSHF6/v7G7aplgdymta4FDtPXX95+YkbpfVVIOPI aI/A== X-Gm-Message-State: AOJu0YxSsrBWpwU7bRPjvEGb0j1bS6ub6sZRZOWfDEAcasrtDSx1WkJQ hsoLCwfGZNvuJ0j3dQ5uZH549dBuVjOcnIDiTBDLcA== X-Received: by 2002:a0c:cc02:0:b0:65b:2738:9bb4 with SMTP id r2-20020a0ccc02000000b0065b27389bb4mr26931856qvk.23.1697015850728; Wed, 11 Oct 2023 02:17:30 -0700 (PDT) MIME-Version: 1.0 References: <20230915105933.495735-1-matteorizzo@google.com> <20230915105933.495735-12-matteorizzo@google.com> <386c175e-bd10-2d5d-6051-4065f6f9b84a@intel.com> In-Reply-To: <386c175e-bd10-2d5d-6051-4065f6f9b84a@intel.com> From: Matteo Rizzo Date: Wed, 11 Oct 2023 11:17:18 +0200 Message-ID: Subject: Re: [RFC PATCH 11/14] mm/slub: allocate slabs from virtual memory To: Dave Hansen Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, corbet@lwn.net, luto@kernel.org, peterz@infradead.org, jannh@google.com, evn@google.com, poprdi@google.com, jordyzomer@google.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 02:18:01 -0700 (PDT) On Fri, 15 Sept 2023 at 23:57, Dave Hansen wrote: > > I assume that the TLB flushes in the queue are going to be pretty sparse > on average. > > At least on x86, flush_tlb_kernel_range() falls back pretty quickly from > individual address invalidation to just doing a full flush. It might > not even be worth tracking the address ranges, and just do a full flush > every time. > > I'd be really curious to see how often actual ranged flushes are > triggered from this code. I expect it would be very near zero. I did some quick testing with kernel compilation. On x86 flush_tlb_kernel_range does a full flush when end - start is more than 33 pages and a ranged flush otherwise. I counted how many of each we are triggering from the TLB flush worker with some code like this: if (addr_start < addr_end) { if ((addr_end - addr_start) <= (33 << PAGE_SHIFT)) partial_flush_count++; else full_flush_count++; } Result after one run of kernbench: # cat /proc/slab_tlbinfo partial 88890 full 45223 So it seems that most flushes are ranged (at least for this workload). -- Matteo