Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1935580lqz; Tue, 2 Apr 2024 02:08:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXchevXB25IA/47J1ELgSQ0nIQyT5uegdv5+9LYzP/ZJPknjPfPdRt4otDdpes0Jx/Z49/gwrH5VoZloIDslwLkb+xA6M/g4PkCxEUXw== X-Google-Smtp-Source: AGHT+IGEeSu8lXngZd4H1EI0X7qlbY+dpGjSRdq7y37BR+pBxWXOATtEv+dEjFv6U1jHqqrMFUY8 X-Received: by 2002:a0c:f98f:0:b0:699:1b4b:c63f with SMTP id t15-20020a0cf98f000000b006991b4bc63fmr816994qvn.48.1712048881054; Tue, 02 Apr 2024 02:08:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712048881; cv=pass; d=google.com; s=arc-20160816; b=GOfwO5FYiDFOERz9tZh9r4pXsSi5tO34DUXzLw5gER3sX7lsxmYkXyog27ShSUDvy2 03BSNVJWsDYHTm6QC8OfatMZAcLsRorJ6mx111RrQ2AOv2/QN/P7hkAP8dwzEiL6aZVY aYY7IScSSCGc5lE/myA/mgnCdjG00AyNFypas7IsNsVTULWf7IFXggz0Oo015Aw0kpiQ Ju6LJJpbh7IYvSXESRIZju43vftexqGahTupBMaIlgKapFdKq/+VeQsrtQTSSBcHtmTG qGBu8/fHNQSbEql543SSRlfEUlI2uXisz3oT8th/Uq5SFctjIUY5wZwl/WrrUS/z5KLk l5cA== 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=Gj2lIs7j0qMeOLAI9CgIcyOVJL5/QjEQamjTy+gS40c=; fh=H1gxdAii3GIr0I8A3zLtDYgml/Sd5tC7z/5q7WkmW3g=; b=euOk3xhTAfnysE0pHH+yvKmweIoB29sjvR2onFSDm/X9Cm4Zvq0IWYC9xDFWwSXMkD 5pNrRX8ei8MNPKAgnMSeoyjs7DNr5YGPpELaIh8/XcXQxhr18ZPjk4XICg+b4Do0xGEw 6WbV3z/NGpjBLCHRHMV24/V6H22W1BmHO/kCnlPWhU7dmFRfj/QBEB5Z/lSxY+K2iz78 v+vw1eJHF5qU5BJnEUo1hOw17FcYnCsu3M/xCMz0zXjVWaOuGzbED+HqUdk5TTGHfD+C 8B9aqwEEl//iTdSy3SY19QC02GON68mAk83wMGh3cAa9kBG8ijvzXlYU1zUtbSGihgyQ NeLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2QX5B+0D; 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-127608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127608-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y13-20020a0ceacd000000b006991ebbac70si422063qvp.49.2024.04.02.02.08.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 02:08:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2QX5B+0D; 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-127608-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127608-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 00D771C2168F for ; Tue, 2 Apr 2024 09:07:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C979557306; Tue, 2 Apr 2024 09:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2QX5B+0D" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 22D8F56754 for ; Tue, 2 Apr 2024 09:07:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712048871; cv=none; b=Nkicyl434zbqPlLEzXPyZ4X80Ei0oFd2Vakjx+eADiu4gBz9bzcp+tiMj7zsWzriJE15YW+m0FEdtM6t9lGB3AyDB2bBL9lcobBnYuEAuuv/lvZ2n5f+hg6rk3hVbG/c71yfOF3GK+LleAwJKXEOAOdJw8U1Hd5N2LkUqsoV4+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712048871; c=relaxed/simple; bh=BmiFl2dlvUSQbFQDIWYMV3yfnVRwHbjvGePU4GqEhN0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VcLWW290ksFZrR1stUW7QM+sj6w7rfnfiTP6aP9j36QZcF3LVZ3Q2qNZKCksdOvENZlFPGpxMmYgSFNME1cRQBHRmJVgUaosXKzgRZYlw+5djmWIH6wT/OZa7a7mKvAGBWISCbj9GkXWFJVGmbl2N1CBYoSaMUDGLldH0NFsxnM= 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=2QX5B+0D; arc=none smtp.client-ip=209.85.208.45 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-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-56c2cfdd728so43473a12.1 for ; Tue, 02 Apr 2024 02:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712048868; x=1712653668; 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=Gj2lIs7j0qMeOLAI9CgIcyOVJL5/QjEQamjTy+gS40c=; b=2QX5B+0DXiqwvck7Z+42zwaJpGf2S/dkfH9YaQC/K9cAKOiFssmHJLmlkl+5F/J5So 1XFmATGk41aWRmthoO9NWyqxcV+fZ/CR8oNkHWt/N1/rcRcrQF4/QSwm9H4hbVZERs++ Al5miBvPdIUBtoFuXc/h0JViqMAylpJi89knJVNWZOpZ2um6osfOH3HKBgwflhXH2oxL BlqTHhFSKzJy1weiirQ8XGHu8FkBonBjid4Bodx0R6GdXZDRROkKOSxEJRHMiZnSEmJB 6O3yAC0ZQMnD8JCq39xiDrTYizilHKrGCdNLhc4s3dPP4b1bzcbh9kqmkpvoTupFIGMz xhpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712048868; x=1712653668; 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=Gj2lIs7j0qMeOLAI9CgIcyOVJL5/QjEQamjTy+gS40c=; b=T4kpMzV16A0kjdz889j1cZtSEKrOSV9Bve0UwEKhsk/6RSs/iCh0eWLEQvijaHyynl gPg2Dgc2KzJ8VwW0ZHwD9NosRxQHQiAlOOo/r4y69Yi0qyGnoQbLe9tz3IdW934tnnv7 4CRtvoiS/suB/irVklcY88YMlyMqv4RlNPMBaOYxe6Ln13o8HvHcQc2lu6U/dyEoZC8K u/mRWv8qsTJArDPWUAB4maxYPRGkxy6qlPNeCLQMItf1jAbc4VpjXqTRcW1FVqkHgddq YOyqxv8xJB9CNgFU/70rYhLkug5Vrf935/QXYlh84lcSptDLTzWyf+gNywJa2NjGEyko GVZA== X-Forwarded-Encrypted: i=1; AJvYcCX7rrsuM7Da4rZJHqOo3BUfmuVhdrF8BhKd6q7NV0n9vFfPPiQiKtN7wTz4DUWrcwGOwLTicNoAGbZHKYpINInKpaF3vxwtjZbI8r+h X-Gm-Message-State: AOJu0YyMnRKcKeDiS7ibO2JHwot+it0lasbSoBNi5nGEhtB/5iptR72E xBSSEtovP4yJ2/lZp/9MtMwYFxXdeOUNemS3bal6S0H/FWOPm7iu5/NsNkU+irYKkfHgEURL3fc MiCkKmA9py/PIzQDpgXC+Q+UK6ggYrxPC6Pwa X-Received: by 2002:a05:6402:5253:b0:56d:eeb0:c76e with SMTP id t19-20020a056402525300b0056deeb0c76emr60307edd.7.1712048868331; Tue, 02 Apr 2024 02:07:48 -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: From: Dmitry Vyukov Date: Tue, 2 Apr 2024 11:07:32 +0200 Message-ID: Subject: Re: [PATCH v6 1/2] posix-timers: Prefer delivery of signals to the current thread To: John Stultz Cc: Marco Elver , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Oleg Nesterov , "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kasan-dev@googlegroups.com, Edward Liaw , Carlos Llamas , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 1 Apr 2024 at 22:17, John Stultz wrote: > > On Thu, Mar 16, 2023 at 5:30=E2=80=AFAM Marco Elver wr= ote: > > > > 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= trees? > > 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.d= e/, > 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. I don't have objections per se. But I wonder how other tests deal with such situations. It should happen for any test for new functionality. Can we do the same other tests are doing?