From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBADF221271 for ; Thu, 20 Nov 2025 21:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763672651; cv=none; b=Tqv2/+Mkg02r1yL7DrLJVcfuimGWj+O1jd6Py3gSnKGyE3/kSIBvGII67a1VIkGCtZcS1iFNkth6Z58ZzchDOcpggMr+Io+dhfLcD8rmKobg40SEKTfLByuautOF0or//nEMfgBSPV7IxFBvgJm7HLwXLI6heWXJRxzhInnUg8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763672651; c=relaxed/simple; bh=TBLE+URWtkhDbwZRJboQY4FNksmKt/N9hmkidJX6+do=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=Q6C++4LM9dUe6A/E6Ey44AdP8K7/OHqpKmWH7BBrXW9QXTtwnl9XvovdJ/NcXAij4y6Squ3r9MVZt5L6v5iV/a0kQSQZm1As96s4zPAZgI6k7QO/cRD076MwjgAD9ymcXkEiK7RD9Ac9rKrHCSjI7/BVR1NaFXVTmacMD1mnZIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dusv1kI0; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=D2S6ItjC; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dusv1kI0"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="D2S6ItjC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763672648; 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=2gP7Rslf2T1AfChLbUJgaiR4X3cBCTmsdxaMC4DWekg=; b=dusv1kI0T5Y4WrufeyLJBQ2C4Y80zJuV1+WT9vwtOqnOcqsy22Z3x2vAW8GZZlGWfvJ50A FFYmo2BDBwiEJMOG01nOc9EWVCqdYbGhSb8NWeuMFnXDzm5uONhHQtMjqtDgNNr/78QbOo BiVsgX7zHiEKtp2yuzXPoGEyaDV9sK0= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-99-e2OaGSOAMxG2ei2aUgsqDQ-1; Thu, 20 Nov 2025 16:04:07 -0500 X-MC-Unique: e2OaGSOAMxG2ei2aUgsqDQ-1 X-Mimecast-MFC-AGG-ID: e2OaGSOAMxG2ei2aUgsqDQ_1763672647 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-88249865db8so33121576d6.0 for ; Thu, 20 Nov 2025 13:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763672647; x=1764277447; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=2gP7Rslf2T1AfChLbUJgaiR4X3cBCTmsdxaMC4DWekg=; b=D2S6ItjCntRIakpwcspYpbV4ibUM/Ksjm7WvvrUhL+msi/6znqPUbhgTJ6bfoSB2ib lHjztVhS7ThWUjPKP4RpSTpo3QxW/LuW4v5rfy5KV4wYnbT3rEtlKB99d/YQmIJCWvDB 1uz778uHqWgQHaXt0qcVAsdRuccO+9MDdkkUDpMsNGMkxMVaSa96rpIOSJz66VZGuoF8 4RN0tyE+mqAz3NfzXbDzqf6fY06hSe/9xLc5vM8ApA2qzfvGJ23VqpOv4DybbcXKSgwU vOzTVS+HpvCSMgFVOSgc9MnkuCJjZB8ky8bDzkBfxk2+QlwsnX2uJI5N+avSFGtjnWRX n5XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763672647; x=1764277447; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2gP7Rslf2T1AfChLbUJgaiR4X3cBCTmsdxaMC4DWekg=; b=c4MqcE9xrxRc0HlcKBF6Jx/hCz+2CJCRPJeA7RfG8riAPh7lfIRMgN7PO3oNdZ0LAt 7Se/T9aIy+w3JrXCr2MOE+rj2l95LgjAZdfTQ+uU0XWniaJjG0IEEx4qU6yCmberkNNR gQkh5NitMIe78vVeoXohkcCAjMJvN61dslK6oJDWPXab7DL7ol3krJeTdJyTYJrOcgEo IBCaqMsyZanheA+MYAfQLU6BD5tGO0y6u2EY7UFUBdIE5U2tA6Rgp67pVHiLr09QYIBL /IOw8onX+DYt5NKDAIYFzDlKKEdgPYwV/lGZk/yNXgtZwS5uaHWj/U1IegLR1YiTarnb Hfmg== X-Forwarded-Encrypted: i=1; AJvYcCUMNCsrweF84ieEgIKn1FaODib6C+WC/QUqIE3VpYhWxu3EOZ+E7hj0ec5Xc8Ck7CwD/51RqVPmd8QQg4Y=@vger.kernel.org X-Gm-Message-State: AOJu0YyjhinKawZj8lMzmv1tgnCmRAbSz0Tb7AaSn4K/nd2rEBE+G9kZ zV60sRrQN/5WczO7pbUq84Ldyxzg6QfzH6dSJYyIsAVaBiN8pd95ePfJiDNZ+m2D2xGlZR3chQB E7qmTb8G4C2GuaiemtPhtu75Msv6xlktunybZwmdzTuHLj+TxWS969VVEmdeD3X6hBQ== X-Gm-Gg: ASbGnctspiIvey9qjEfws8v7UAQd2jZXB6YqNV8hsSxDUEZoUbDe+fpjYp6wJ2ZC3m+ l5nbTEZzsfo/ZxPpLuvHSHuk6wiEd6xk82U/m5azJijWudSU63RpBkEwqLG1L0keCQhCrZ7vBRj c2u//JhvzRRQ/ZoaPStMirzC9y0cRDNwGvfOwnAwQNXmZZ5z+POB9pe21LqOLFxyOZfhFRKnzc8 V65bMBkqhfu+zCAsQympOo7c4YdK4wOmxDWPvPlgwZHMVfjBTYT45s1JBzxp+0MPgruvkYsgSmt UgDXdkCGE8KrEhAq0lzxjBbW+nSf7pYVo7gjDW7yjOQAeIkPq6tYM2xujeEwvgWHOWh4D5FsZRI GiDLBMqXZVAAIQ/BXMSHqUSIAFiRGbWI94jv8Lb7tmHhgPrRe1XqdqfXT X-Received: by 2002:a05:6214:5d0e:b0:882:7571:c024 with SMTP id 6a1803df08f44-8847014a5f2mr50972286d6.27.1763672646696; Thu, 20 Nov 2025 13:04:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0jsyDk4HwsxWV5fDtOydpJlwXQdmMTOH0Am+i+cSubVfuQPt2zeLzfwPrUVP+50W1hyqj/g== X-Received: by 2002:a05:6214:5d0e:b0:882:7571:c024 with SMTP id 6a1803df08f44-8847014a5f2mr50971826d6.27.1763672646305; Thu, 20 Nov 2025 13:04:06 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8846e446458sm24193586d6.12.2025.11.20.13.04.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Nov 2025 13:04:05 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <187a05e7-fcf7-4ed4-99a6-fbece3add5c3@redhat.com> Date: Thu, 20 Nov 2025 16:04:04 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v15 7/7] timers: Exclude isolated cpus from timer migration To: Gabriele Monaco , Waiman Long , linux-kernel@vger.kernel.org, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: "John B. Wyatt IV" , "John B. Wyatt IV" References: <20251113083324.33490-1-gmonaco@redhat.com> <20251113083324.33490-8-gmonaco@redhat.com> <55c5b273-7b68-4636-824e-ddd5ee757f87@redhat.com> <1976fcd8034c1a1dc06fdd10e09b7df5ed4037ac.camel@redhat.com> Content-Language: en-US In-Reply-To: <1976fcd8034c1a1dc06fdd10e09b7df5ed4037ac.camel@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/20/25 5:48 AM, Gabriele Monaco wrote: > On Wed, 2025-11-19 at 15:43 -0500, Waiman Long wrote: >> On 11/13/25 3:33 AM, Gabriele Monaco wrote: >>> +static int __tmigr_isolated_exclude_cpumask(struct cpumask >>> *exclude_cpumask) >>> +{ >>> + struct work_struct __percpu *works __free(free_percpu) = >>> + alloc_percpu(struct work_struct); >>> + cpumask_var_t cpumask_unisol __free(free_cpumask_var) = >>> CPUMASK_VAR_NULL; >>> + cpumask_var_t cpumask_isol __free(free_cpumask_var) = >>> CPUMASK_VAR_NULL; >>> + int cpu; >> There are currently only 2 callers for this function - from late_init >> call and from cpuset. Concurrent call is not possible. Maybe we can just >> pre-allocate these cpumask_var_t and percpu work structures once and >> reuse it instead of doing an allocation and free each time it is called. >> The pre-allocation can be done in tmigr_init_isolation(). >> > I have no strong opinion on this, but after changes suggested by Thomas it gets > superfluous to allocate 2 cpumasks (after flushing what is now cpumask_unisol > it's no longer needed and we can re-use it). > > Considering this only runs at boot and every time a cpuset changes isolation, is > it worth the extra steps to pre-allocate? It is just a suggestion. We can see how it goes and decide if this change is needed or not. > >>> >>> +/** >>> + * tmigr_isolated_exclude_cpumask - Exclude given CPUs from hierarchy >>> + * @exclude_cpumask: the cpumask to be excluded from timer migration >>> hierarchy >>> + * >>> + * This function can be called from cpuset code to provide the new set of >>> + * isolated CPUs that should be excluded from the hierarchy. >>> + * Online CPUs not present in exclude_cpumask but already excluded are >>> brought >>> + * back to the hierarchy. >>> + * Functions to isolate/unisolate need to be called locally and can sleep. >>> + */ >>> +int tmigr_isolated_exclude_cpumask(struct cpumask *exclude_cpumask) >>> +{ >>> + lockdep_assert_cpus_held(); >>> + return __tmigr_isolated_exclude_cpumask(exclude_cpumask); >>> +} >>> >> Should we put all these functions under "#if defined(CONFIG_SMP) && >> defined(CONFIG_NO_HZ_COMMON)" like in the timer.h header file? > I think that's implied in the build condition of timer_migration.o > https://elixir.bootlin.com/linux/v6.17.8/source/kernel/time/Makefile#L27 > > At least I got these ifdefs from timer_migration.h and none of those functions > are ifdeffed in timer_migration.c You are right. I haven't check the condition for building timer_migration.o. Cheers, Longman