Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp121833lqp; Thu, 4 Apr 2024 08:33:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUt4HJDCOQReH0o+bbvKzGRJVToAaEqmTKLENVPsulmnT51tydL2ZBIlXkyyQHDbEMc8l+Rfs66JwOEfsyle+EEJnk9Bzjo/JZMaVeI6w== X-Google-Smtp-Source: AGHT+IEgomE/BVssTDnx6HMZC/xWKMzYH2S/aFoeF5aWdlnZzAVJ8x7fXH91sNqY99VNuOFb3Y1O X-Received: by 2002:a17:906:4acb:b0:a4e:89f2:c625 with SMTP id u11-20020a1709064acb00b00a4e89f2c625mr29108ejt.26.1712244808874; Thu, 04 Apr 2024 08:33:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712244808; cv=pass; d=google.com; s=arc-20160816; b=eCUey5ex8zHq5fSc5IwqdWaVChIXGUJe3S3lo4vjTJESVf4PsMMGChUrvO0wbn2uyn G2kI7lEao3XCvmWkOitQHM29YGAcoj8nPEmdBSiT6jNtngaXWXd3TSN+0ZhBiCJhPvmN ON0LzVQLugj5hZu9Bl2/oZjEM0CiHjRdJz+iQV2mWnEPKWlouhnZyN5hQ8njbMNX+klV LHgXPgoZMdD8fyCkk9Ih1wFtR1F4k2JrMrh+cfKdZrWjgZ51T/8u1r76vD3vwiIja3Ap YZDbD42QFcVSpH72uHuROe1CNKBfDvkd49dL3+7kH38MBxDwisKFXZCWn8SNWEzaWnga SN/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=EyANxchTUq4vCZ8B0GlMj1ALpGGfgcRd78F9nkanEmk=; fh=ct+SAC++KuMnHEs0TDY7BoMNklHQXTXWPHBS4yDpdlg=; b=lAa+zf4vZsfdjMr/DhCLMfYOuHL4z4C2Xt0Q4GS53RnY42SqbTYYa1nWwLpLBXARpY Tp0R7s3r1A5HmHEt9pc3BZ/caamOTVKQgT22zVqRe/wqYUepuYhK2IOQaQttn9DHFvs4 NDhVaT8QQ/as0CgOE8PDwFAqDVH5ixKpsN4AFRk0WzxQS85o4Q0T/XR9xkYH6dB85/6p 5I6QB6N7SbbXH9M+YhFANf1JG4E2BTtrXBSJM/wwwRb3y7WYMYrNTvv4UhzAtolEAPRb ThCzJ1O/erBvtdI4LDMGlv9C/t2GXSnfqHtkbQMIB3/ixIRuJuKaYgoLt7GgOblzTOTF mXjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LpXanQ8O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-131722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cd10-20020a170906b34a00b00a519c85f8efsi98147ejb.4.2024.04.04.08.33.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 08:33:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LpXanQ8O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-131722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 07C951F2B1B8 for ; Thu, 4 Apr 2024 15:26:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9B315C8FE; Thu, 4 Apr 2024 15:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LpXanQ8O" 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 E50481C2BD for ; Thu, 4 Apr 2024 15:25:52 +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=1712244355; cv=none; b=gH/83KCs14ynAAMIE3udCAH2dvQDwsdYAnJ1pvxZg+AqbNM6oUxeF/v0dbK3EqdnsmEOqP70YRq0V7akI9aR3qO6uDsabapHesn3EfqziQi1Lr5zH3tnKJwg8M8xAo3SLv1cQSHuMLSzy0jW7jYDjrRRKEruNpJPHrb7xCHE0G0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712244355; c=relaxed/simple; bh=EyANxchTUq4vCZ8B0GlMj1ALpGGfgcRd78F9nkanEmk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rsTp5SEC1798q55Hc3WoO181vc57j6rZuXmZUbMGkx8XVEhCKlZgL8drY+YFoMuiFochBftmnhrYD8JHrCr/4Dig6/DpBieA8RE8WNwPEut5fEym7E4HyinSt25oaIxymclwUiAq7Uri5A3IlOCzSHk7WZpQ8qz2CKEkCeu9IIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=LpXanQ8O; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712244351; 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: in-reply-to:in-reply-to:references:references; bh=EyANxchTUq4vCZ8B0GlMj1ALpGGfgcRd78F9nkanEmk=; b=LpXanQ8O1I2dnfBRiblgyj80UxaqRHvRjga/pEjQOR9KHgdMbw9Sol/tBHI1GIoB1OaVkb QokJrxDRHhzB6ITlX2UQVxPLnv4lUGByNbMX/CLfi5pD4QjGc8QSabMTYvyFCDovxocJV1 OgLgp7GmI1d2sMvaiXPC3Ywk/59CnBg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-tUm63H4bOu2bbGcK_ijisg-1; Thu, 04 Apr 2024 11:25:46 -0400 X-MC-Unique: tUm63H4bOu2bbGcK_ijisg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE27680C76B; Thu, 4 Apr 2024 15:25:45 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.21]) by smtp.corp.redhat.com (Postfix) with SMTP id BAF1D40735E2; Thu, 4 Apr 2024 15:25:42 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 4 Apr 2024 17:24:20 +0200 (CEST) Date: Thu, 4 Apr 2024 17:23:57 +0200 From: Oleg Nesterov To: Thomas Gleixner Cc: Dmitry Vyukov , John Stultz , Marco Elver , Peter Zijlstra , Ingo Molnar , "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kasan-dev@googlegroups.com, Edward Liaw , Carlos Llamas , Greg Kroah-Hartman Subject: Re: [PATCH v6 1/2] posix-timers: Prefer delivery of signals to the current thread Message-ID: <20240404152356.GE7153@redhat.com> References: <20230316123028.2890338-1-elver@google.com> <87frw3dd7d.ffs@tglx> <874jcid3f6.ffs@tglx> <20240403150343.GC31764@redhat.com> <87sf02bgez.ffs@tglx> <20240404134357.GA7153@redhat.com> <87v84x9nad.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87v84x9nad.ffs@tglx> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 On 04/04, Thomas Gleixner wrote: > > On Thu, Apr 04 2024 at 15:43, Oleg Nesterov wrote: > > > And this will happen with > > or without the commit bcb7ee79029dca ("posix-timers: Prefer delivery of > > signals to the current thread"). Any thread can dequeue a shared signal, > > say, on return from interrupt. > > > > Just without that commit this "eventually" means A_LOT_OF_TIME > > statistically. > > bcb7ee79029dca only directs the wakeup to current, but the signal is > still queued in the process wide shared pending list. So the thread > which sees sigpending() first will grab and deliver it to itself. This is what I tried to say above. > What we can actually test is the avoidance of waking up the main thread > by doing the following in the main thread: Hmm... I think it can be even simpler, > I'm testing a modification which implements something like the above and > the success condition is that the main thread does not return early from > nanosleep() and has no signal accounted. It survived 2000 iterations by > now. Yes, but please see a trivial test-case I sent you few minutes ago. Oleg.