Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5178509rdb; Sat, 16 Sep 2023 06:14:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1y8vEYUZK3/mxs0mRM/X8MOx4wZ8/me4Lc12OlrzID9WqGPeXSA3dGSdTyjJwChaEz17U X-Received: by 2002:a17:902:d483:b0:1bf:25a0:f874 with SMTP id c3-20020a170902d48300b001bf25a0f874mr5432477plg.65.1694870063474; Sat, 16 Sep 2023 06:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694870063; cv=none; d=google.com; s=arc-20160816; b=jIFibtw+ysZeO0+/N2gBQympyga7a5zUbwq2FI3PQ5y29asI1+6KYhuFZGQM+O2cDx qVdfI+MIFANsI2bVg4KWx6IJLbpdcZRCm4lQPM4Ixp5CsnE+ywKHdQsJ6VBhUUUPK+NB iUuMvdyWXoAz6zvEJCiA5HHHjELcUSQW/m2cK/R2s/xUzYBZBNqg8atjPZdGwYHkWpbT EkM42ZdB/Ft8Nj+5iOJ3KvUXw+Ko6vIMrpaVHlPFnMfJqlkm9r5cVG8yZmaG3RbCURpk MYZtL4XEKB8Zdc+Nrxg8XL9JScKBxUPgFxvG1CjTjBV9Pcti46m109FBYbnx/z33KaC7 LIew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Jm1LHs5ifpSDu/XW+B25deHi83oEbW4Uj6npp8dfSc0=; fh=31Fx692EmifepzblYF06vXEa+yvx1MefEtdaP5sc0Rk=; b=tYO4eR2IS+ilBHDEU9MUUX09VC6r6T34AgU6gpzuwpnbPVNX3M9HqizRcscG5xWO+K 6dmeMHVLZMwChxyZBfU3pD9hCnurJi2UuWfKP9UB7wDgIOXdee6JQdd83sSjscdv/gDI VuwsgiiE5tVoNO7jjf4gx+CExcyyQb9aH7FHsrdYwD1oVyUdX5rzNAukczT55uYxtO9L fXofUO5sd1+YRfLh5M0FXvj2zgEj9Ye1ZnSBMURkJNEBXTkpjhoV7O63LGgFI3aRSCEb bKuH8fFse+ARscmvKUiNma/1Fjyy1h2dhoKdOJEydCw855u9sIsmHavxdEgxAAD6X0Ma iW6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mX2jt0Xp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q12-20020a170902eb8c00b001bbc80a2a3asi5000907plg.299.2023.09.16.06.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 06:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mX2jt0Xp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 490A482A39B5; Fri, 15 Sep 2023 14:58:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236653AbjIOV5f (ORCPT + 99 others); Fri, 15 Sep 2023 17:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236460AbjIOV51 (ORCPT ); Fri, 15 Sep 2023 17:57:27 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69820118; Fri, 15 Sep 2023 14:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694815042; x=1726351042; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6hO70gqgOmSzHdBwhYaT2sixpZXe4bhY694b9GTBrYY=; b=mX2jt0XpfjEYDIl+1oxhJr5aEXH/H5i1k6Cfrsl2dn1OmAYEqm7Lmun6 2woBwG0ZbaBlJso8lJe9+miffp154BANZzQlZrysqe8kaEDzUj5m/YsRH haiA1eo+9QuIcNGXj1K7CZDuGkKWPHPmMKrmO1L6mHORQlcyjMojn13wT PbJDXItvrrhQZBp5H6ZGs3oaoRptriCoTHk/b8YbhonMWCnkB2FsbgsrN ZbYbR0Frvpi0IOwXsYBXzuvtQM9envBf5tFrgcFHP5s6iDAIqSzvA52Bj Pa48Kx9pz7UNF0zr8nGnPE5D01G+oyAbTuQ9jU18A04CDh2NgLHTgQLAU A==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="376680817" X-IronPort-AV: E=Sophos;i="6.02,150,1688454000"; d="scan'208";a="376680817" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 14:57:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="810663939" X-IronPort-AV: E=Sophos;i="6.02,150,1688454000"; d="scan'208";a="810663939" Received: from spswartz-mobl.amr.corp.intel.com (HELO [10.209.21.97]) ([10.209.21.97]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 14:57:20 -0700 Message-ID: <386c175e-bd10-2d5d-6051-4065f6f9b84a@intel.com> Date: Fri, 15 Sep 2023 14:57:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC PATCH 11/14] mm/slub: allocate slabs from virtual memory Content-Language: en-US To: Matteo Rizzo , 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 Cc: jannh@google.com, evn@google.com, poprdi@google.com, jordyzomer@google.com References: <20230915105933.495735-1-matteorizzo@google.com> <20230915105933.495735-12-matteorizzo@google.com> From: Dave Hansen In-Reply-To: <20230915105933.495735-12-matteorizzo@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 14:58:03 -0700 (PDT) On 9/15/23 03:59, Matteo Rizzo wrote: > + spin_lock_irqsave(&slub_kworker_lock, irq_flags); > + list_splice_init(&slub_tlbflush_queue, &local_queue); > + list_for_each_entry(slab, &local_queue, flush_list_elem) { > + unsigned long start = (unsigned long)slab_to_virt(slab); > + unsigned long end = start + PAGE_SIZE * > + (1UL << oo_order(slab->oo)); > + > + if (start < addr_start) > + addr_start = start; > + if (end > addr_end) > + addr_end = end; > + } > + spin_unlock_irqrestore(&slub_kworker_lock, irq_flags); > + > + if (addr_start < addr_end) > + flush_tlb_kernel_range(addr_start, addr_end); 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.