Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp701456pxm; Fri, 25 Feb 2022 17:41:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfRFO33rLbx4ybZZT8pgUf0KyDrdgqx/105Oc7x+k0D8mI1ugNIDQwlsa5SSmVP//Gmy8K X-Received: by 2002:a63:6982:0:b0:373:494a:22ae with SMTP id e124-20020a636982000000b00373494a22aemr8479153pgc.624.1645839694339; Fri, 25 Feb 2022 17:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645839694; cv=none; d=google.com; s=arc-20160816; b=O2gKbP37Ha7/qofxeIbkt7z7qar4rMybvDFyA5iI+6q3JeA9HxDGgFFHfxh9m9Nmwg HOGgEuYjCfFVjWEtnbU8CcX24O/Yb6h8Y6uinYZ+F3UcPH4CJnNlDD/kPo+XID0+65Nv MlCDaVkWaXPK+xBKxDnvcxuXVN6kIGQtLg5aVIE3rUd1RF5Q2awxz9vgF4fetlKbYbag bLTYp+GXoPvh6RLcYsDptuqW9dbjRlmLPoSudseCSyetJHxyMslTk0UFuPIRGTy8x0Hy 3mbn4h1nShaDfKEb+R5GeU64JNmm67pq9G7xbxx1aeC3FuTdWt5CKvkezE1EiSotbTXN uRjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature:dkim-filter; bh=oUN6Pog7J8FgoaWGTBczYy16pRgLbEf5z+vxasmFPJ4=; b=aUzXAWf+5jJ0w9ovY3qmnpjFspovWyN3fA5YzNrWv3mqbnhQ+SIzkixSOXPqsr/LfF kE9cqgL3psKNngbCfuW0FGGajfwQ73QhfT62ihwkxThg4AwaTWsNjS9YQvYs0ONKerIV iH/b/asuALUu8e+dCeMaSAQEugAcG/K60pQftNZd92eti0rJlhZqu0Vm2XMWYNh9nAMo HWNZcBdLKBTlKLEsWUdth4AyUAgeh59mY6xO2T6GLWqG53XqPZA3Z6L30DAiWT4sdv3B vRk/OTdIsVQqCjFFeS0mF+kZX/EpkkKPAUTRm7S9mVJ7euOjgOKtu2qs2Xz+kJ4Z+eP1 A6Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=r7wIfyR5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w22-20020a63f516000000b003743d5f74a2si3296063pgh.349.2022.02.25.17.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:41:34 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=r7wIfyR5; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8B33C179A07; Fri, 25 Feb 2022 17:33:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbiBYSPq (ORCPT + 99 others); Fri, 25 Feb 2022 13:15:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbiBYSPo (ORCPT ); Fri, 25 Feb 2022 13:15:44 -0500 Received: from ms.lwn.net (ms.lwn.net [IPv6:2600:3c01:e000:3a1::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6AE1F634D; Fri, 25 Feb 2022 10:15:12 -0800 (PST) Received: from localhost (unknown [IPv6:2601:281:8300:104d::5f6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id A49E22A0; Fri, 25 Feb 2022 18:15:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net A49E22A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1645812911; bh=oUN6Pog7J8FgoaWGTBczYy16pRgLbEf5z+vxasmFPJ4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=r7wIfyR5nqun/xkfnd1eampwJGtpTzMwGB5yA76V+8NAGQmLmkOACFoZXyS5099ZI 1pTngONPzPM0JrjVm144/0g0/eKwBvHUkgxyJhIPpZKM0arwNMf3TZV1d9DmIqrKTj 1aqGEgZSBxumAX6NkwTXHM4wbzlR5vqzCsgxQooXmR14Sdlq8EwkvHt/RTh35wpLmf NOQ2Vz2dTlrS+XCFrTTtPwkuqUV/f1lp2kLzGSmtRJw0iqXYElfTHppsGbvyX4TRIj HGeDoW+31I2edKkf7BQsmbYxzMTdV3foMGiZ6vFeh77elayUwKX5oAXZKsMrjdVxUr Xz2OGoeFKmeNg== From: Jonathan Corbet To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel , Thomas Gleixner , paulmck , Boqun Feng , "H. Peter Anvin" , Paul Turner , linux-api , Christian Brauner , Florian Weimer , David Laight , carlos , Peter Oskolkov Subject: Re: [RFC PATCH v2 09/11] sched: Introduce per memory space current virtual cpu id In-Reply-To: <1323451367.108396.1645811762372.JavaMail.zimbra@efficios.com> References: <20220218210633.23345-1-mathieu.desnoyers@efficios.com> <20220218210633.23345-10-mathieu.desnoyers@efficios.com> <87k0dikfxa.fsf@meer.lwn.net> <1323451367.108396.1645811762372.JavaMail.zimbra@efficios.com> Date: Fri, 25 Feb 2022 11:15:11 -0700 Message-ID: <8735k6ke34.fsf@meer.lwn.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Mathieu Desnoyers writes: > Some effective upper bounds for the number of vcpu ids observable in a process: > > - sysconf(3) _SC_NPROCESSORS_CONF, > - the number of threads which exist concurrently in the process, > - the number of cpus in the cpu affinity mask applied by sched_setaffinity, > except in corner-case situations such as cpu hotplug removing all cpus from > the affinity set, > - cgroup cpuset "partition" limits, > > Note that AFAIR non-partition cgroup cpusets allow a cgroup to "borrow" > additional cores from the rest of the system if they are idle, therefore > allowing the number of concurrent threads to go beyond the specified limit. > > AFAIR the sched affinity mask is tweaked independently of the cgroup cpuset. > Those are two mechanisms both affecting the scheduler task placement. > > I would expect the user-space code to use some sensible upper bound as a > hint about how many per-vcpu data structure elements to expect (and how many > to pre-allocate), but have a "lazy initialization" fall-back in case the > vcpu id goes up to the number of configured processors - 1. And I suspect > that even the number of configured processors may change with CRIU. > > If the above explanation makes sense (please let me know if I am wrong > or missed something), I suspect I should add it to the commit message. That helps, thanks. I do think that something like this belongs in the changelog - or, even better, in the upcoming restartable-sequences section in the userspace-api documentation :) Thanks, jon