Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5702252rwl; Tue, 4 Apr 2023 02:16:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YB8ldukd1X5uhw6YPKpTOINKMc7d10VjPsmeJJEl7B9Glzy3jbwePQmi9xFp36qKXYvEZo X-Received: by 2002:a17:902:f98c:b0:1a1:d624:2fef with SMTP id ky12-20020a170902f98c00b001a1d6242fefmr1854427plb.44.1680599796119; Tue, 04 Apr 2023 02:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680599796; cv=none; d=google.com; s=arc-20160816; b=yAGTN3f+Oqj6LKWz5pYtjjCSUzya8yoP2Ual35E5ry09Fr+5hbrPa9M5YvQqUeMups VBKv2fUyqBRAboobCoUSKYxUNoXhwLx5/IqwohfrqTSbmA/LKNkdY81jUcPHXiRW8jDe 0Zh/06zK6mA4vggQZUv06GPuEY3bmvFSwSPpWX+7VwfMLdrau4ofY7xptdf8f/ViffXY hELjjk9F9sn7gT0NybpuD23/lh/WCgvogjDMm3bDbzHgkWbtxG6FI59yXxxla2392W2J 6q7CZP4yrh1ZyKH271IXfvusQJoJs+KDn7cK5brD1ul8fV0cVuYY/bnm9AcfW/U0pukg ylJw== 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=3BLV145yEOOg3kMKk7nR/SxSLasIzM+jajDrhUwMqq4=; b=yxvQm0WUq6c+pTdEghfCqR0LRY8y4cQuB+W2l65nZNJ5cGLJihKXNLNsTW/6oVGCNT 2FYUP17NoRbjn8PzeZ0XXsWgkSBeQDf5LnZFVomDHcMIi0O5ttz+1tXoLfn+RMn4jFIZ mKoQZlQauFZQFnGWCw9OHWxS0pOYfjSWs3PzVoc5I4B47o1akvn2ewHFedbSploLrkSi BBxvokkxT2L1IdlyQODNfYt4nA/m1DJh7ugxIr3HUtyktvZ3TxFwx9Y1H5D9nDfOwi0t k5/8Fiyos4keD8VxpzXa3WEOvv894/JGFmQcXf/+MxBeEUy/u3MQp84InG/T6z0OzEv+ 1CoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jatgy0+7; 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 v14-20020a63150e000000b00508db9b93b1si7129839pgl.485.2023.04.04.02.16.23; Tue, 04 Apr 2023 02:16:36 -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=jatgy0+7; 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 S233699AbjDDJKN (ORCPT + 99 others); Tue, 4 Apr 2023 05:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233375AbjDDJKL (ORCPT ); Tue, 4 Apr 2023 05:10:11 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 997CE10F8 for ; Tue, 4 Apr 2023 02:10:10 -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=3BLV145yEOOg3kMKk7nR/SxSLasIzM+jajDrhUwMqq4=; b=jatgy0+7808bPpujJVChAqGktI wR8YCUuntcqJZ/EloiJOIL8/axRpuHURd5S26MMBi/qrvhQpzS372/SsaQ6IbZkPFGn+cwbSr3mwQ zg6o8EZUGwzgDYvXn9d9D69DohP6lIGHU20AP6nz2Es0J+QxlJQ7oSxxTufE1U8TDwVInhVUBdzQ9 6bpfa1hfWsHD23+e4w2bUl2nAeiklQLKJw+NbiqVULK87ZmthGqEeANfdIWblcbxZAg088AZXj1Du 9CgEtn3PpU5yAOmdpKAxfIZD+PvO9FkrTu5JUevUFXHK2sSrumOUTUsMB4fzHbYJKQjBHjSPzqhMa zIlBWdQg==; 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 1pjcg2-00FDJH-7a; Tue, 04 Apr 2023 09:10:06 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A7A5B300574; Tue, 4 Apr 2023 11:10:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8E1BD242109FF; Tue, 4 Apr 2023 11:10:05 +0200 (CEST) Date: Tue, 4 Apr 2023 11:10:05 +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: <20230404091005.GA285330@hirez.programming.kicks-ass.net> References: <20230403181342.210896-1-mathieu.desnoyers@efficios.com> <20230404085749.GA284733@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230404085749.GA284733@hirez.programming.kicks-ass.net> 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 On Tue, Apr 04, 2023 at 10:57:49AM +0200, Peter Zijlstra wrote: > > 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.. Ah, mm_struct::rss_stat[] beat us and set precedent, so not our problem I suppose :-)