Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1667817lqz; Mon, 1 Apr 2024 13:17:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlphUGKtFjNq327YxXQQcXsCdDtyjMNEaH3plyJj4L2SZ7MIzJS6iT9WnxN4WiixPWBYwm7aMSDM1+bDOHIriml65nhipl52G+E8/txQ== X-Google-Smtp-Source: AGHT+IFPJ1dvFm64T1feDEX5vnq3OpZqNZ0ddZ3g9Y3/1bFBX3ps9GWO65hvMQpQUm4prq21vLro X-Received: by 2002:a05:6a20:9186:b0:1a6:f8d3:3b6a with SMTP id v6-20020a056a20918600b001a6f8d33b6amr14586442pzd.16.1712002652263; Mon, 01 Apr 2024 13:17:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712002652; cv=pass; d=google.com; s=arc-20160816; b=zzYKukAM7yjRyHInTyz2LepV6g+PcGm9rr8aPtxlbHaxJ+vIseMF48BylGJwBG2mS6 xVcvgBXoHopX7gCvy9OTwZGJP/eoIsoLGErJ2IaTQtODDi3Iow2JFCi32HIaI4Qtwhr9 EjlY4kG1UNK43Po9EWSzi8ubOoSzx/cevpuHQl0erP3rlTtsA1DTIABqhMw7E39GXxZn NsykvNN/PwwvzuEgwfvOhip0BDp3pREOvTR2PS1j+Wdqmb6F5Sy8JD+pBtt9wcYyzWMW TibZuSt5ZLYoAa4kpjsCGB6DVRrg8DZclSN6Cff27GBJLrA840k88KC1OXix1Xn1bpyn lzWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=J3aFjL6s1SfTb0uIG99KnzgQCy9He0FDmkud5jyqZjA=; fh=zK0rV8YUevUihd7Zv+mXDUJ9xIWv9goYfUqvxnmz6gU=; b=EJkseFp7Y/86RSPkQs7e+kFehp1p26RjLQ0eXAojzCt5CY2jKSmu2XD2hLVVHmlm/A VNXQl9YoT3WMUGPZh/1vvaCOFNPjQSTxliCcKIuAKJoK50Q0lG3ZFB5D7B/7s3Ig2EgP e1nGxMp86nAbFvTgom/N78q+RGQ1SUvaW1EpP7WNBaiv5bcMkjVEDIbVVB6IizRM6oPJ 2C7FT89LqK7bBxBBJr3kaLWC3rmTAFCFNnDHZqxmzc/P0i+AIhcjcW1axv/NXldyuyD4 dGdaTeFouxD6R1ZKZN9RPstQXbi3Cj04MV+x0FV7Di1NoSG6tP5xUcx5vSrP935O+5Ga UlIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aAiPbrGh; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-127021-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127021-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fd37-20020a056a002ea500b006e7302e5edesi10010801pfb.150.2024.04.01.13.17.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 13:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127021-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aAiPbrGh; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-127021-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127021-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CE7A9282ED5 for ; Mon, 1 Apr 2024 20:17:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B89D53E12; Mon, 1 Apr 2024 20:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aAiPbrGh" Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 962D0537EE for ; Mon, 1 Apr 2024 20:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712002645; cv=none; b=r7KRD3NOOIJzTeMTzt56pjEnPz0Sy1ZPs5Vrp3F5lETKX3Q30jDGyKy1uD2qqlZs7O9nGvVDcJTAyqDckgyuPo6kzwAxXGxyzZyLAV/wlDQQ0LB2XB1hQIn9YH4mUBlPSBpKLPYlY+EDkvfjx8OATIzbGIJq3W5R5X2wgObFhK8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712002645; c=relaxed/simple; bh=DHtBhqBNeZBIKrY/GX3JtpOpPT1r6vgPt3XKywQu1Os=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=c+SmF+mvQkH9PV91F5/oy00ROHJfvrr5SD4zgODiEY1FgG/8NgnYMPDsoeX+XW9e9+iNricXAi+vYa+X5s3KUVhTUWz5cdcQUmbxAjtl4HB2rtgLz2jIO5qitPm7g/2mYZfkQODz+QVBqh0Mf5MYGZyQDY+Itj4DXumr8mV4VJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aAiPbrGh; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-413f8c8192eso225385e9.0 for ; Mon, 01 Apr 2024 13:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712002642; x=1712607442; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=J3aFjL6s1SfTb0uIG99KnzgQCy9He0FDmkud5jyqZjA=; b=aAiPbrGh4OnL9TCoh/ir7CKcMXHdrs7U1Kw0YmHTEqofzsmjb2xjhroFlMP56MnhAK ce2M0R8W2K+uh5APaeY9aliOMrrrrA3e6RhCmz1Ltow/3YrStYO0JbKBgJqHSysuSeU6 G3ka5zVN0GMCNbiJ1ZpWtFULncwEbCWM4H5b+X/4GmypNwQJxWdlgsfuesMDKwuG25bk 4G8/WsmZt3O210YXOKGciDvGH0hvGAHV1AOue/C32RIY9R+Zq8GcSnEFSsfJ/abSwHFD 7OkVjL132DRWPrjHqkfil8rI2oyRuF1pLBM7a+eLjiVcmZP77p/fh4LPtNxjsvKgBWAb VRSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712002642; x=1712607442; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J3aFjL6s1SfTb0uIG99KnzgQCy9He0FDmkud5jyqZjA=; b=XCaIIEbyVDhJfikI3ThbSuCtn/u3FJGp7U7LNQpXn07oqtWTCMIXp0gHEPHk29/uD5 deXU1ezAI6OSf9MPESFFnbgPQeqLhrvfcZE4aviUg8CZ1n7ounAC8GE3sHGFd/mkahLS PpG8X9OFuOw877OWaHLQflgnj1fXbIaZUgLecYiuPhl/VUmr/OY6FImmvo2cSwOvoMfw oByPouLNqKUh9I0HFZF5zfezPk+y3DdQtR4uBw5i/3oE+7q5VSyBe1HM6NKT1A+lpBbN fEdb/dPEf1w/xTnqLjw1+nNi0lCkopAwiS/usFO4+pQ0KM5pOUo4DkIO1xb6PINE7AFu mTrA== X-Forwarded-Encrypted: i=1; AJvYcCWw8aRyjk75jQnWzi712OSf7a+16i+Iim3J7bE4pCbbFg0SvMEy5krUr/1iB60fcopn2/LV0WLEyAwfMRvmMnxxoGaslKSdu14s5F6x X-Gm-Message-State: AOJu0YxaE+TNjk4+4VUK+yBRRjjxoB4gmtfm8nP99wK0u4BuBAdvUBRW XCyHD/jTuw9G4izo8iZCxHGVyfyTG6eO2CGkYiRAgwSCcAAR2VemZxZXWYfXgzA5k1B0Kl9ELki XyPLWhNZMGxqyk/dQJnYiH7rmMYfwR2CGjYo= X-Received: by 2002:a05:600c:3587:b0:414:800f:f9b1 with SMTP id p7-20020a05600c358700b00414800ff9b1mr640853wmq.2.1712002641819; Mon, 01 Apr 2024 13:17:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20230316123028.2890338-1-elver@google.com> In-Reply-To: <20230316123028.2890338-1-elver@google.com> From: John Stultz Date: Mon, 1 Apr 2024 13:17:09 -0700 Message-ID: Subject: Re: [PATCH v6 1/2] posix-timers: Prefer delivery of signals to the current thread To: Marco Elver Cc: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Oleg Nesterov , "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Dmitry Vyukov , kasan-dev@googlegroups.com, Edward Liaw , Carlos Llamas , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 16, 2023 at 5:30=E2=80=AFAM Marco Elver wrot= e: > > From: Dmitry Vyukov > > POSIX timers using the CLOCK_PROCESS_CPUTIME_ID clock prefer the main > thread of a thread group for signal delivery. However, this has a > significant downside: it requires waking up a potentially idle thread. > > Instead, prefer to deliver signals to the current thread (in the same > thread group) if SIGEV_THREAD_ID is not set by the user. This does not > change guaranteed semantics, since POSIX process CPU time timers have > never guaranteed that signal delivery is to a specific thread (without > SIGEV_THREAD_ID set). > > The effect is that we no longer wake up potentially idle threads, and > the kernel is no longer biased towards delivering the timer signal to > any particular thread (which better distributes the timer signals esp. > when multiple timers fire concurrently). > > Signed-off-by: Dmitry Vyukov > Suggested-by: Oleg Nesterov > Reviewed-by: Oleg Nesterov > Signed-off-by: Marco Elver Apologies for drudging up this old thread. I wanted to ask if anyone had objections to including this in the -stable t= rees? After this and the follow-on patch e797203fb3ba ("selftests/timers/posix_timers: Test delivery of signals across threads") landed, folks testing older kernels with the latest selftests started to see the new test checking for this behavior to stall. Thomas did submit an adjustment to the test here to avoid the stall: https://lore.kernel.org/lkml/20230606142031.071059989@linutronix.de/= , but it didn't seem to land, however that would just result in the test failing instead of hanging. This change does seem to cherry-pick cleanly back to at least stable/linux-5.10.y cleanly, so it looks simple to pull this change back. But I wanted to make sure there wasn't anything subtle I was missing before sending patches. thanks -john