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.133.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 B264B1EA7DB for ; Thu, 20 Nov 2025 10:48:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763635712; cv=none; b=r71b8i/Uvc1ccwL6CzWAwnNWkmGKLA3QlMdAaTa2Hd7f0DajRSWMn3Br+0Z8Davu1T4tCllfnHs2L1P4p+U3ZlnbUWJ8qFKWPGHedHVg7JVZaVeiVk2q9TR/lW8n53tZQe89Z1R2LOrAJHpssVTWhqWmV1DzBlLdBhGHSdDhIzY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763635712; c=relaxed/simple; bh=xrgRDg3SmlXpMHSL0T7WsbAJgvw1aGMwdu+nCNlZQbk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=CV/paOH3jLbjg54m1QLuorFZBdEH3CgERgKuIaCGfDSXUbwpI0zNS55DNRWnV1Z1xvPAoarh97M7Kncl21jj+MUs8UpHgrmYfFt2KE0j01gKL9WRooGToTEs60jGEeXpATcu0Xqe5KKMzjJF5FHR+EjoDFaX+FIToqO2vcxlzWY= 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=SuKkuneo; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=JgRNqAf8; arc=none smtp.client-ip=170.10.133.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="SuKkuneo"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="JgRNqAf8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763635709; 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:autocrypt:autocrypt; bh=mE4hefeldS7OFdRu+ieIS1po6UsQbl2IXAcDtXRtJsw=; b=SuKkuneozXGCY49QFU1dhdxYi6GiQU2krkKzxgjNWUFYfK9VxHkYc0CZwnu6o1kVf0J3uV c4+EmR5Pfmv9jneHpydVAF1Vk7eDBcx1efu5YELGRCVmYZ6+8GjZRKmX9EcbEKPZRP/u46 EvcrHRbxm3YxVHC2Z8BS3FcDEsYJzfg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-ZF9mJQrFPZ6fax06-Q4e-A-1; Thu, 20 Nov 2025 05:48:28 -0500 X-MC-Unique: ZF9mJQrFPZ6fax06-Q4e-A-1 X-Mimecast-MFC-AGG-ID: ZF9mJQrFPZ6fax06-Q4e-A_1763635707 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-42b3339cab7so513704f8f.0 for ; Thu, 20 Nov 2025 02:48:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763635707; x=1764240507; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to; bh=mE4hefeldS7OFdRu+ieIS1po6UsQbl2IXAcDtXRtJsw=; b=JgRNqAf8Fq1O/d69AdLMHYfgNCAN8aXkCJMGKi06MkXTu7Q/2APiyjgUT14JYe6I9e KkAsDgJDaxQcj1diNsBuvNyZg25unSvynDU8XQSMEzzOSwpmwqoHNj3bGQIF0aFTbh1Y YYgZoZAM4gRQtdZdG4V3F2V0cfIaGr+SwXuGPMzY2VowHSqr4dpSsQbFacwzZa4h0DWy mjSr4MJoHWWiwMXzYAim/MYqmU0P1yHorNWhfAtBzTPMCyxQtVu1ZOcFaOWg0bbp+pOL Wb6gA9w2i090ADAiDwaloS6bIyEsIzqmvGZmCXgIAWYD3mFwiaLZkuPGu+Mf1Lw5Sv9f 8TBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763635707; x=1764240507; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mE4hefeldS7OFdRu+ieIS1po6UsQbl2IXAcDtXRtJsw=; b=OQ0Pde6uLwn2ERh99DDwrF6qwJthK9IcbEvTzXV53l/KT41wGQ7MPan1/FqF+2aVqj 6//M2GKbK7DP+L1asVE+N2ETKoFnmn6rno2mgXw0XMki9OBi+jYGa3WgMMC6844Imvz8 XOFQw85fViWprr+5BLjH5Uk4VMvP/iQ3EoIegvmmCjcVVkIbq6BfgkDuX4sa5SBr2rgH 4pbUPFUe9nd/yPwzwx+tyeVxFbiy+FbJA9XOWOyLedsh8eJpXSrvVBmopVD9YvPuehTG CkItO3ecTEKA+nD/tIWLsvTqYcZurnN26etzDAgG6aFO4pc2QU3oM2qOlvPQDcGAaLu2 FjMQ== X-Forwarded-Encrypted: i=1; AJvYcCUG+OlH/3y1dRuEx9PTBocQNyMwTULHHzzHR78hyiFKUjXOyTZk/MEZE5vedRB/QXXU35QvNUJiu8qyRA8=@vger.kernel.org X-Gm-Message-State: AOJu0YyE+P5eRY3kk4Jy3FPWyiNEeaYXBTJUzynx0lccRG2lZBJVaBVo 1EmeLqbmZsmhMab3J0B0+Oug/tc8kYxIiT5b5TJlOmXRUsfMXE1DpHImR328Sk8G14M6J7t0kIl pSMLKZI7nG2KA9cq25rIKO3X5wi5l1y48wYSIGIptiIIJicSqPVrPBboPEF2EbMU+Eg== X-Gm-Gg: ASbGncsVQpeb46kiDWkITLKKV0ilHky0ohBL9657vFKiG+2SwiFIpo/lFFKSRcyg5q5 lX2VNz/0MdbduoZCymdfbCVxrONK/F27Spy3/Uj1+jhr+Iy3RPEBlN9VwOSWC6AuDQKoEy0hJwN 5d0ZVNoySx/rAx7SrqrAPdghtVi/FoBzW8bADXhPpyoGbnhE8fhbJM4BLq8YyuiWMQ366xfkSef TvCP54anyfJEK46GaHHr5NsDH/c8YdfxZX+pCOOD3IpFWGtlyxuJKOMGSlOltXbvVSmnXG5xpSj FSsUBtp41sZzRzXUoPWnDA/N3sVuRIztP2fBb4fB3LkbZ128QtcIZy6aF2Xvq4HN5xrAN56XaLd lUrxsr7iVc5c40zjGGQ/3zr5PEciQZdW7BK0= X-Received: by 2002:a05:6000:1a8e:b0:42b:32c3:3949 with SMTP id ffacd0b85a97d-42cb9a3edb7mr1965889f8f.31.1763635706687; Thu, 20 Nov 2025 02:48:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhUlbR+rrxdqTS4k1zSpQfwrI3Z61+VRx+xrSx47SzumKOO/7wbRGg55lpddAK/CXCDk2AYw== X-Received: by 2002:a05:6000:1a8e:b0:42b:32c3:3949 with SMTP id ffacd0b85a97d-42cb9a3edb7mr1965864f8f.31.1763635706255; Thu, 20 Nov 2025 02:48:26 -0800 (PST) Received: from gmonaco-thinkpadt14gen3.rmtit.csb ([185.107.56.42]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42cb7f2e581sm4442992f8f.8.2025.11.20.02.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 02:48:25 -0800 (PST) Message-ID: <1976fcd8034c1a1dc06fdd10e09b7df5ed4037ac.camel@redhat.com> Subject: Re: [PATCH v15 7/7] timers: Exclude isolated cpus from timer migration From: Gabriele Monaco To: Waiman Long , linux-kernel@vger.kernel.org, Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: "John B. Wyatt IV" , "John B. Wyatt IV" Date: Thu, 20 Nov 2025 11:48:24 +0100 In-Reply-To: <55c5b273-7b68-4636-824e-ddd5ee757f87@redhat.com> References: <20251113083324.33490-1-gmonaco@redhat.com> <20251113083324.33490-8-gmonaco@redhat.com> <55c5b273-7b68-4636-824e-ddd5ee757f87@redhat.com> Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0BrZXJuZWwub3JnPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmjKX2MCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfIQuAD+JulczTN6l7oJjyroySU55Fbjdvo52xiYYlMjPG7dCTsBAMFI7dSL5zg98I+8 cXY1J7kyNsY6/dcipqBM4RMaxXsOtCRHYWJyaWVsZSBNb25hY28gPGdtb25hY29AcmVkaGF0LmNvb T6InAQTFgoARAIbAwUJBaOagAULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBMrKEfgLgd0WcK eo9u9KbElYeE3yBQJoymCyAhkBAAoJEO9KbElYeE3yjX4BAJ/ETNnlHn8OjZPT77xGmal9kbT1bC1 7DfrYVISWV2Y1AP9HdAMhWNAvtCtN2S1beYjNybuK6IzWYcFfeOV+OBWRDQ== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 (3.58.1-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2025-11-19 at 15:43 -0500, Waiman Long wrote: > On 11/13/25 3:33 AM, Gabriele Monaco wrote: > >=20 > > +static int __tmigr_isolated_exclude_cpumask(struct cpumask > > *exclude_cpumask) > > +{ > > + struct work_struct __percpu *works __free(free_percpu) =3D > > + alloc_percpu(struct work_struct); > > + cpumask_var_t cpumask_unisol __free(free_cpumask_var) =3D > > CPUMASK_VAR_NULL; > > + cpumask_var_t cpumask_isol __free(free_cpumask_var) =3D > > CPUMASK_VAR_NULL; > > + int cpu; >=20 > There are currently only 2 callers for this function - from late_init=20 > call and from cpuset. Concurrent call is not possible. Maybe we can just= =20 > pre-allocate these cpumask_var_t and percpu work structures once and=20 > reuse it instead of doing an allocation and free each time it is called.= =20 > The pre-allocation can be done in tmigr_init_isolation(). >=20 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_unis= ol it's no longer needed and we can re-use it). Considering this only runs at boot and every time a cpuset changes isolatio= n, is it worth the extra steps to pre-allocate? > > =C2=A0=20 > > +/** > > + * 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 sl= eep. > > + */ > > +int tmigr_isolated_exclude_cpumask(struct cpumask *exclude_cpumask) > > +{ > > + lockdep_assert_cpus_held(); > > + return __tmigr_isolated_exclude_cpumask(exclude_cpumask); > > +} > >=20 >=20 > Should we put all these functions under "#if defined(CONFIG_SMP) &&=20 > 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 functi= ons are ifdeffed in timer_migration.c=20 Thanks, Gabriele