Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2564550rdb; Wed, 4 Oct 2023 05:21:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSR9/J18JwOejWogMh9EohRERbomWD6c0IlncBQqTb/8oJlq7L64pKIS9PC/E0Y/aU+BJe X-Received: by 2002:a05:6a20:5488:b0:159:f71f:4083 with SMTP id i8-20020a056a20548800b00159f71f4083mr2173775pzk.6.1696422074893; Wed, 04 Oct 2023 05:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696422074; cv=none; d=google.com; s=arc-20160816; b=sOlMr6kldNIbZuLPW4nrE3ZVFkIrB5zQWwsTguZzPco4Oxg1uGPD4LPVAFg7XXrPv8 Df3bmrKQiXRPKqIZxWWWLD7VeIYnFNtER25pyPe1mK8OzMEAw8gV8gy4IKy43/eqAv/5 A9soiEh0KwojOGEqz+pXMpeZmiznUHYMLMEEdHQXU9TnGMvlfUTsUvnDhPdoXxuTfBoU fnSmGcBVJwcVbSVLgKI4gloOWvufGhtLU2P1Mu4BojfFOLKMYQGscK3f817ZyDO6EwEF NWKSEF7gc6QtCaF6sR2JpvfoW5dygyv1MQZFAckyo8CGHxhzlAiJGBdp584yfEhJhe++ JuUg== 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=eCki2r9Bn0BuFn05o7Il1NR+6SHO0CDb++6+9dm7szM=; fh=OFBouzIhBs1RQXULWrOyD4pAdnI9RPyZDe08TJ87hWo=; b=NGqCw5+cFXnfsyyyoUJUn5U3ZdqqZwyswS1SM7xG6nL5DjPfYJTvV0DPsKpfCTwEyx Ft4cQJ7GRR87xar1arseR2VuM28sSsweIB/Rn5cHHnsfN+B1C7J4P5TyKmP1rrlpd+Fg 2GzfCwkJGIb7R95H60O2ISB7ii2eNslxxUss+Ruk8fNyH4yE5yZN0iRrup7tqaXRr9un HWHpm4giDDYfISl9DJFQj3PHLpX5byPjgZ6glhcvlHj8s0jvWf2Tw0rG+bPnpqLJMRGY 1tF6PPPrtUbAR4qSqdS52uAW8aSSDIbWvmGFQ4ffkKsshpYWu4AQPzur8C0oOaPi44x+ tMHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YkMHm7iN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c5-20020a6566c5000000b005859e224617si3797110pgw.818.2023.10.04.05.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YkMHm7iN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id C6AE780AEB1B; Wed, 4 Oct 2023 05:20:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233074AbjJDMUz (ORCPT + 99 others); Wed, 4 Oct 2023 08:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233226AbjJDMUy (ORCPT ); Wed, 4 Oct 2023 08:20:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81770C6 for ; Wed, 4 Oct 2023 05:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696422002; 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=eCki2r9Bn0BuFn05o7Il1NR+6SHO0CDb++6+9dm7szM=; b=YkMHm7iN/f7EWjHqDR2EqRDVAhyB5DXVN39FYCIc5GNjjdTJOxqxpFVqmUuFb4L6NMzrJc aCANj65FdLPmGUN5OJ+6FnjE6DS+SbsokfOJCqvn5R31/cSXMLUNsjVisnmxan+4hF5QQ9 /byMPT1egxTsc9UzynXXu170/BEPuIw= 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-1-CxTm9tFtPCqpzMCnO1N7AQ-1; Wed, 04 Oct 2023 08:20:00 -0400 X-MC-Unique: CxTm9tFtPCqpzMCnO1N7AQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 501E23806739; Wed, 4 Oct 2023 12:19:59 +0000 (UTC) Received: from [10.22.32.136] (unknown [10.22.32.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78670C15BB8; Wed, 4 Oct 2023 12:19:58 +0000 (UTC) Message-ID: <7a7bc23f-be01-d06a-42d2-a2a121577b09@redhat.com> Date: Wed, 4 Oct 2023 08:19:58 -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: Ingo Molnar , Peter Zijlstra Cc: 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 , Florian Weimer References: <20231003205735.2921964-1-longman@redhat.com> <20231004083648.GI27267@noisy.programming.kicks-ass.net> <20231004094330.GL1539@noisy.programming.kicks-ass.net> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 05:20:56 -0700 (PDT) On 10/4/23 06:06, Ingo Molnar wrote: > * Peter Zijlstra wrote: > >> On Wed, Oct 04, 2023 at 11:23:41AM +0200, Ingo Molnar wrote: >> >>>> if (user_mask) { >>>> - cpumask_copy(user_mask, in_mask); >>>> + /* >>>> + * All-set user cpumask resets affinity and drops the explicit >>>> + * user mask. >>>> + */ >>>> + cpumask_and(user_mask, in_mask, cpu_possible_mask); >>>> + if (cpumask_equal(user_mask, cpu_possible_mask)) { >>>> + kfree(user_mask); >>>> + user_mask = NULL; >>>> + } >>> Question: is there any observable behavioral difference between current >>> (old) all-set cpumask calls and the patched (new) one? >> Very little I think -- the main difference is that we no longer carry >> the ->user_cpus_ptr mask around, and that saves a little masking. > So calling with a full mask would actually work fine on 'old' kernels too, > as it's a 'reset' event in essence. (With a bit of allocation & masking > overhead.) > > This pretty unambiguously marks the full-mask solution as the superior ABI ... I am fine with that one too. I do have a little bit concern about that the difference in behavior when the full mask is passed in, but that is reverting to the old behavior before commit 8f9ea86fdf99 ("sched: Always preserve the user requested cpumask"). BTW, we can probably check the in_mask directly earlier to skip an unnecessary cpumask allocation and free in this particular case. Cheers, Longman