Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5683918rwl; Tue, 4 Apr 2023 01:59:56 -0700 (PDT) X-Google-Smtp-Source: AKy350YfzWYDhNCv6HFHm8JTy76rpwEjj4ZuQYZbNuEGc0/kUeS44d2dwaVDxxBRTuoEkQNX7DGL X-Received: by 2002:a17:906:71d8:b0:932:e9c7:c32 with SMTP id i24-20020a17090671d800b00932e9c70c32mr1650224ejk.59.1680598796627; Tue, 04 Apr 2023 01:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680598796; cv=none; d=google.com; s=arc-20160816; b=dEltRv1HmwKE8zHYDDzLrHxdc1wt3V1ii+ZbgoVSvvW+jE2y+kuD43rCqwAP0s9LGw 6/i2rNIhRXyiQl0mcmmJtN/6lc/E5k/0ncmZMoEzMK69OPw2i+YLrd2RrnhSAduKXh+p lV4jaVO7xaN4LhYmDROol5dH6MUevmI/P8hHHDrt4/CQXiRupRMPRfIRFfp4XzTvXf80 RTLDpQG3tYv8oTcWpcbABKFermWWYyJF/EKKxqXX1wd9r1EV88I5iQzNquqpVB6Zl+jV cUtYxJahJ9E4xLTANfj4Q06qx/A4KwQvYQoOypdt73TclieKYMxvGNz2aBB/LAxXT7uf 8A+g== 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=6LazMVRn6NnFVN/DGpqyJKNdqqZ1WB0zgjGpnPrQ73U=; b=rVfYgeNaSIIITZx9pEAxL3OjxPBQUQ65wEWIqE7bmmDMxdFXPZ0Bc/PIua1tlqonAN 4McSlPZAN7sF96xRNgadAXb/bA0Nq42EDLWZKdjerGLrA8vjCfw9PceEocGjADlocOwR 9fZ+QoRSZKnrBBulddzKEPIKqugQIcDLk1Bh+4yMHIYkbh9S5oalPWKNFkSVcOgnbisb g/7ke6mfXdZomxj9WjsbO6t4+A1XF11wGh6HomKNG7uvJYFdFLMsxyX1FAJqj6m3mApA lVVK27no8GL1U19FTxieh4Pk6ILChbM7//v3HhOHH5ViRlberz+772Mk+9TKo+d458yP oMSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uhtWX++Q; 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 a13-20020aa7d74d000000b004fbc39bd3a9si11076313eds.318.2023.04.04.01.59.31; Tue, 04 Apr 2023 01:59:56 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=uhtWX++Q; 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 S233901AbjDDI6A (ORCPT + 99 others); Tue, 4 Apr 2023 04:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233752AbjDDI56 (ORCPT ); Tue, 4 Apr 2023 04:57:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E711C187 for ; Tue, 4 Apr 2023 01:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6LazMVRn6NnFVN/DGpqyJKNdqqZ1WB0zgjGpnPrQ73U=; b=uhtWX++QeGxiq+IBIFvaGjuBAv LYW5viqH5UGIfKpG35gShVF4+na5mR8k+0UxRUUxNKsn4UDfNe2lR41i0vXyzArWagxXJ4K0MWKfI 3FuggorIKtetMYkUQ36ezREuWiOlpnLT4XAkFD1gvrR5QAg489cSvclfqSX7s3OtDegpWmqhCapz7 qXhTa8KIMlADC+h1+Xyst+DorrpOgK7tTti6Z1pxeFCvRzxJQ26nCVzIuasSYJ1xYWF8U7rudjCLJ tJjB2V4gOd3j0Ts0KjWeiK/pBafTVjJSQC5ZUU5GguYaY7AjfhyMppczHYDnDKYtC1FlkKk58NEfJ GTDrsoRg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pjcUB-00FCs2-7X; Tue, 04 Apr 2023 08:57:51 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 24CB630003A; Tue, 4 Apr 2023 10:57:49 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AAF3D2B6E1F52; Tue, 4 Apr 2023 10:57:49 +0200 (CEST) Date: Tue, 4 Apr 2023 10:57:49 +0200 From: Peter Zijlstra To: Mathieu Desnoyers Cc: linux-kernel@vger.kernel.org, Aaron Lu Subject: Re: [RFC PATCH] sched: Fix performance regression introduced by mm_cid Message-ID: <20230404085749.GA284733@hirez.programming.kicks-ass.net> References: <20230403181342.210896-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230403181342.210896-1-mathieu.desnoyers@efficios.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Sorry for being a little late to the party. On Mon, Apr 03, 2023 at 02:13:42PM -0400, Mathieu Desnoyers wrote: > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 0722859c3647..21466fdc4dc6 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -609,6 +609,14 @@ struct mm_struct { > * were being concurrently updated by the updaters. > */ > raw_spinlock_t cid_lock; > + /** > + * @pcpu_cid: Per-cpu current cid. > + * > + * Keep track of the currently allocated mm_cid for each cpu. > + * The per-cpu mm_cid values are serialized by their respective > + * runqueue locks. > + */ > + int __percpu *pcpu_cid; This *might* be a problem... Consider running *many* single threaded processes, this could exhaust the limited per-cpu storage (32bit) or use excessive memory on large CPU systems. Consider having to allocate per-cpu storage on a 4K CPU system while only running single threaded processes -- but *LOTS* of them..