Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp627859rwr; Thu, 4 May 2023 07:41:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5XGc2t2HjdB1DqYkAr3Soo54CNcspzQu6T5wNW14YxA194R+4ZAt1f7+tLoypZmfr3W8Wo X-Received: by 2002:a05:6a20:12c7:b0:f0:2d4a:8855 with SMTP id v7-20020a056a2012c700b000f02d4a8855mr3192652pzg.8.1683211269854; Thu, 04 May 2023 07:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683211269; cv=none; d=google.com; s=arc-20160816; b=Evbtj7bAcf5HDnHx7qekCUWl13VkGl68vkJwHSwdQZV1bWlDP+JUBLxawY7COUqrhU La2lLJpcgp0HubsKpQqgmQ/Sf/PL0Wa9JDS+zFiLAO6aYPIqHQbu6OUA5IumbNHZOkbC 9hnbxhSxvn6nPmjdfRNDcvhcFxQIjd0O7YtaTk/zvb1jR09R1n7uv9qTPN/pWSeG8X4d PxbMp1A4tpw4sNqRsLOc1zyx7Jp5Z/9uuxWrdJElkzYfToKBL2cyaVbU8zmgqNtA3OeP +JiScGYFVUzIymXEJZ0LhtObBTb38TqApANPlM0mqotvtT1lakOXgrvF7l2cvpG9KUjP xCaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2q1Na0yWnrxCd8vbOMPYz/xcczauSqn9EWcowSr4XIc=; b=G0cXTFWfLOa9MlZDEkXruU8ZTJtAqRRB9QybSDvMj2z0OKzgVXoSK25TL0BEM2Wra3 tC8+SBYLuMlFanrFBUdnCuRMIVB/vrNZUkv5PSEN7yz9IGgjYu/57GmDg8LKPJGM788v EApDoA5zQ4DFf8wutKAGvXUXIycGzzHFbqSzTpF26aRwola7boENhmRQOpQwvLF9U+DT BDgLNwVGkbqU8XobRfKAjyeQYANB7WkdGpKiMaL7H011u8+RD0YR1VuNlPoii1g9zqPJ JXimCT/vPYa2QB0O4QSutAwNyVsoL5VGwXgQwrEPc7bvzxblPfF4PPoQAvkYxQ1dqmz3 0jdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wY435xR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c36-20020a631c24000000b00513af3211cfsi36389396pgc.453.2023.05.04.07.40.55; Thu, 04 May 2023 07:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wY435xR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbjEDOeL (ORCPT + 99 others); Thu, 4 May 2023 10:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbjEDOeI (ORCPT ); Thu, 4 May 2023 10:34:08 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E36764ECF; Thu, 4 May 2023 07:34:04 -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=2q1Na0yWnrxCd8vbOMPYz/xcczauSqn9EWcowSr4XIc=; b=wY435xR4+CwjWJ9LFIuoGNLvka dWhDGn6W86+Jw2I/OQeFmzzO0qD+fBbP3yVQp0sM1CR/teYcmmDcgl7GBOFKOQSHTENMB5bmM3GPp zVXmNn67yldM41vjaysbtH01Jhot9+lcxiJpmEEhjAZpKMxYdveWf/j9OvdjJmGK+WjIPMlmWLl5p 9gBS9h/QsBg8D94BHw1CiWsHknlJbHfMrvSqAysHP7kQCKIGSdlDc8TyClJ5j+ReW3CcVrqSXHJNi usjNCB2JInauUpoRSS90LDcX1yVTo/OQaMomlLTol0RXpWSIqneB3B2GKMu6IMpj4k+RiS5+PwaTC xu4uxQFw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pua15-00Afz2-Ky; Thu, 04 May 2023 14:33:08 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 807333002A3; Thu, 4 May 2023 16:33:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0432B263B6381; Thu, 4 May 2023 16:33:03 +0200 (CEST) Date: Thu, 4 May 2023 16:33:03 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: Wander Lairson Costa , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Will Deacon , Waiman Long , Boqun Feng , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Eric W. Biederman" , Brian Cain , Kefeng Wang , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Christian Brauner , Andrei Vagin , Shakeel Butt , open list , "open list:PERFORMANCE EVENTS SUBSYSTEM" , Hu Chunyu , Paul McKenney , Thomas Gleixner Subject: Re: [PATCH v7 2/3] sched/task: Add the put_task_struct_atomic_safe() function Message-ID: <20230504143303.GA1744142@hirez.programming.kicks-ass.net> References: <20230425114307.36889-1-wander@redhat.com> <20230425114307.36889-3-wander@redhat.com> <20230504084229.GI1734100@hirez.programming.kicks-ass.net> <20230504122945.GA28757@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230504122945.GA28757@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 04, 2023 at 02:29:45PM +0200, Oleg Nesterov wrote: > On 05/04, Peter Zijlstra wrote: > > > > Urgh.. that's plenty horrible. And I'm sure everybody plus kitchen sink > > has already asked why can't we just rcu free the thing unconditionally. > > > > Google only found me an earlier version of this same patch set, but I'm > > sure we've had that discussion many times over the past several years. > > Yes... see for example > > https://lore.kernel.org/lkml/CAHk-=whtj+aSYftniMRG4xvFE8dmmYyrqcJyPmzStsfj5w9r=w@mail.gmail.com/ > > We already have an rcu pass before put_task_struct(zombie), see > put_task_struct_rcu_user(), another one look unfortunate. Ah indeed, it got mentioned there as well. And Linus seems to be arguing against doing an rcu free there. So humm.. Then I'm thinking something trivial like so: static inline void put_task_struct(struct task_struct *t) { if (!refcount_dec_and_test(&t->usage)) return; if (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible()) call_rcu(&t->rcu, __put_task_struct_rcu); __put_task_struct(t); } should do, or alternatively use irq_work, which has a much lower latency, but meh..