Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2721398rdb; Wed, 4 Oct 2023 09:26:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEocPVuenEKTU5KmmOueZewfhMHPRNrN4hh0DPBQfiXWS0W50r4Xa5M9qkSS6fGtDXJDDv3 X-Received: by 2002:a05:6a00:1592:b0:68f:cf6f:e212 with SMTP id u18-20020a056a00159200b0068fcf6fe212mr2868296pfk.20.1696436773268; Wed, 04 Oct 2023 09:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696436773; cv=none; d=google.com; s=arc-20160816; b=NAgRJeqI1BWVDHblUh6W/bHrZSuQsND7yOWs8BMP51rIWcyKAbyu7agU7ECXO69xiQ fizjBmhryvrFY+Z+Djlj47LD455TY7yqWMY5+RQMl4sglR0jj/CchhC40SquLZgUqGVx sD6JbsC+SXBuRVe/mA6S9aGNALPGpx2deeGYhm4ZL2jt7cFi843Jt7XJI7FxlrdQ0yCi gZwuMZb1iOhL3tXr6lTMBGDt6Vugm+jvk+1ttifpuIhdmuj6sLidH5ONn+TGxYEfbzCO KM26GzfYCApXOngfKIt5Lxb9orniLwOiwJ22t0BIxeQH7LgqTG734YP+btShZ12oUuux df7g== 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=kHHB0nuT3xkUSZTp0095FiMfUGouLO4qSIAie4xx6Z4=; fh=hePVA2nij1/GjmVd0gCoc83RONGGgtrCBSaqjL8i3yU=; b=YKWTRrZCR9eq/QraRmgqOY+y8QnYlXH9J+9BkjeuoH2RfvSBWhzi8kIOc3zM2+CNNO I7V4NqM0V5ooQDdQo/n8iJrksm85ZD6gzBKOOJoMpVQq+7d5ij+Tub7LN9PTefaM3xDD itIMaxwHUOnrLenc/7mLxSBvHua6q0jzLU6zVaQdZxmopYR33nveNA0wNpzQ4pZPdfLA KWQp/IeYH3STm87595HS7Ei2RKXyYWtoobwYk5MW+bEV9OEvoKM/eoZVGM0j+MWQkP3y fCTJ9TV7apnghKxoi7APQlIuEtuYUMWZIv0N+EvaLcuyPc7tOrFlwGeNq8VTvenxIa5Y ZSIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GFFQs4Um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id bw10-20020a056a00408a00b0068a68d71b68si3825855pfb.216.2023.10.04.09.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 09:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GFFQs4Um; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8605D8085982; Wed, 4 Oct 2023 09:25:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243357AbjJDQZN (ORCPT + 99 others); Wed, 4 Oct 2023 12:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243350AbjJDQZL (ORCPT ); Wed, 4 Oct 2023 12:25:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC504CE for ; Wed, 4 Oct 2023 09:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696436624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kHHB0nuT3xkUSZTp0095FiMfUGouLO4qSIAie4xx6Z4=; b=GFFQs4UmPsWbASRJ2tI4j5mBvnHYRFslWbLGZMgdH0ho2SqQpdvWlXLKDL7VAxWiFLVWOm cpc+0M/74oVBX7vj3VuIepjNB5viXI9dIl/4aedENh6zkNXC/SM0WN38K5onK1fHTi7DpD cMOghJv18+y/GhKUoS8r+WoozjD2UsU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-y9HjJXybP7OcneZxV6mywg-1; Wed, 04 Oct 2023 12:23:30 -0400 X-MC-Unique: y9HjJXybP7OcneZxV6mywg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE6533C2864B; Wed, 4 Oct 2023 16:23:29 +0000 (UTC) Received: from [10.22.32.136] (unknown [10.22.32.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02BB01005B8E; Wed, 4 Oct 2023 16:23:28 +0000 (UTC) Message-ID: <0c36c117-b44c-89ef-1988-6059c41fad65@redhat.com> Date: Wed, 4 Oct 2023 12:23:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v4] sched/core: Use zero length to reset cpumasks in sched_setaffinity() Content-Language: en-US To: Florian Weimer Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Phil Auld , Brent Rowsell , Peter Hunt References: <20231003205735.2921964-1-longman@redhat.com> <20231004083648.GI27267@noisy.programming.kicks-ass.net> <871qeaefco.fsf@oldenburg.str.redhat.com> <4a4076c4-c6ad-063d-a2e1-3048cf71f723@redhat.com> <87mswycztd.fsf@oldenburg.str.redhat.com> From: Waiman Long In-Reply-To: <87mswycztd.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 09:25:44 -0700 (PDT) On 10/4/23 08:55, Florian Weimer wrote: > * Waiman Long: > >> On 10/4/23 08:34, Florian Weimer wrote: >>> * Peter Zijlstra: >>> >>>> Subject: sched: Add CPU_FILL() >>>> >>>> Add the CPU_FILL() macros to easily create an all-set cpumask. >>>> >>>> FreeBSD also provides this macro with this semantic. >>>> >>>> Signed-off-by: Peter Zijlstra (Intel) >>> My main concer is that obtaining the size of the mask, or at least an >>> approximiation is not exactly easy. If there's an expectation that >>> applications reset the mask more often than they do today (I don't have >>> the full context here), then we'd some decent interface to get the >>> approriate size. >> I believe the macro just use sizeof(cpu_set_t) as the size of the >> bitmask. It is the same case as in CPU_ZERO(). > I mean the CPU_FILL_S macro also defined in the patch. Correctly > written applications should not use CPU_FILL and statically sized CPU > sets. Right, that can be a problem. If the input bitmask size is less than cpumask_size(), CPU_FILL_S() won't work to reset the cpumask. In fact, it will treat that bitmask just like a regular sched_setaffinity() call and set it accordingly. With that caveat, I would prefer to keep using a length of 0 for the reset then. Cheers, Longman