From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 374E4C433E0 for ; Tue, 11 Aug 2020 07:45:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 03B0F20656 for ; Tue, 11 Aug 2020 07:45:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sNGFyDNR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728000AbgHKHps (ORCPT ); Tue, 11 Aug 2020 03:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbgHKHpr (ORCPT ); Tue, 11 Aug 2020 03:45:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4999C06174A; Tue, 11 Aug 2020 00:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mvBglLhqvGMAFuaPGFgRV204Qh8cN+T3G3Kwu055G6c=; b=sNGFyDNRyAVLLb/esg/uL4KXQI oP4g8D+ZTk0n4UzJLPNZOaZ2O+ygnBhcrRF69yS0OZsaKkkjXkj4XpfDU8qF9dHXKPUuCYuWaz7mr i6hkUMXL9+U+xpQrPxMsIfeafR5Ppoxxal10bp22yXtjAroBEU7qqyCPEpaoUxTgCN1elEVTIATNL rXMhAiXw7csosoMranEKeykZ7mJhT8X6qn1oLKGLhoDnB7MIJkcs7qV3YcpdDetp39xXSCm82lCod fR+XMimyZfEE/dsgWSdN6It50NAAtADTtcaOnQGPXt05Eop+0cNGdWjOYQaDRitdbZqidBoXcrM9K IygYoxOw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5OyZ-0005qy-RS; Tue, 11 Aug 2020 07:45:40 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id D35FF980C9D; Tue, 11 Aug 2020 09:45:38 +0200 (CEST) Date: Tue, 11 Aug 2020 09:45:38 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: Jann Horn , Jens Axboe , io-uring , stable , Josef Subject: Re: [PATCH 2/2] io_uring: use TWA_SIGNAL for task_work if the task isn't running Message-ID: <20200811074538.GS3982@worktop.programming.kicks-ass.net> References: <03c0e282-5317-ea45-8760-2c3f56eec0c0@kernel.dk> <20200810211057.GG3982@worktop.programming.kicks-ass.net> <5628f79b-6bfb-b054-742a-282663cb2565@kernel.dk> <1629f8a9-cee0-75f1-810a-af32968c4055@kernel.dk> <20200811064516.GA21797@redhat.com> <20200811065659.GQ3982@worktop.programming.kicks-ass.net> <20200811071401.GB21797@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200811071401.GB21797@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Tue, Aug 11, 2020 at 09:14:02AM +0200, Oleg Nesterov wrote: > On 08/11, Peter Zijlstra wrote: > > > > On Tue, Aug 11, 2020 at 08:45:16AM +0200, Oleg Nesterov wrote: > > > > > > ->jobctl is always modified with ->siglock held, do we really need > > > WRITE_ONCE() ? > > > > In theory, yes. The compiler doesn't know about locks, it can tear > > writes whenever it feels like it. > > Yes, but why does this matter? Could you spell please? Ah, well, that I don't konw. Why do we need the READ_ONCE() ? It does: > + if (!(task->jobctl & JOBCTL_TASK_WORK) && > + lock_task_sighand(task, &flags)) { and the lock_task_sighand() implies barrier(), so I thought the reason for the READ_ONCE() was load-tearing, and then we need WRITE_ONCE() to avoid store-tearing.