Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1607337pxb; Fri, 1 Oct 2021 14:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaksMW3IMDPUMILTTxcxTyW9fT4x3kkGFvQa8kxeiAVzz/hOz0FMEvqe4S/zCMJW6ZX9ym X-Received: by 2002:a17:906:31ca:: with SMTP id f10mr282572ejf.73.1633124720199; Fri, 01 Oct 2021 14:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633124720; cv=none; d=google.com; s=arc-20160816; b=JojRVzXyyrAIYSO6dxX7Y5Y6vjf2Ip2G08RpTj6pQ3x9zfMV1a04nj8AvJ6E8Ef5Hh 8YHFpf0cYqjkL8TEmRwdZtmSPrhQ3A9hi9Mm6ADhpHMunDDJogs6FWd9EiILhR6G7LLP +FnZSQsOFmySa4alG0NkZ5Hexj6mYtrRKduvFYjwSHkA8tl0PDsnZx9PEDdCKSvoMCgT KYZsN/RI1Bm6JxTKIXAZZare3flZY7crEGHFN5xdSEMdQgfUspK0x86KR/xT2hsUSpzW nrQ974QX0mjQ0E0zqDGqEMGM9eWPSoOcvSu0yIJpFWWo8HtJYt+AZum7EksCfJneS0Kd H7TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=tqUDfDbD+LheVFGVx1ttBWfxP0P88MXIJpplml+x1eE=; b=eMgcwRxHC565c7nRxSxuDqnvVyXgyFc/Lok32CWklSqzDMK6rORUUEhdmaCyQ6rxcA j8GkFpXJGv0CYOUTUd2m49tKGVlM+6hwwmPgJFWXkUuDTQhGb3afcIrc6IW62UP+DRSd LjIMGpSwl8mXSDpyILOISFw64VSsr4KZ/3bONssTC0MEKXlMtSMssyG3WNlv2boqZc8i tvLmADfWFopizmNFUoFiIYyOrDvEoLT7HK7RccxufCTpco+HPYEsVLQcv7xlH4y0Sh9p uBdfQ7VTt93Mu5sSW+elCGtsZv1jwmSM+B10JVqtHJ4sYiqv3EN/mVdPg+yvaTLW4VIm ynhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=do2XRzWd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Hl2AoXqT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk24si8435246ejb.480.2021.10.01.14.44.54; Fri, 01 Oct 2021 14:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=do2XRzWd; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Hl2AoXqT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355556AbhJAUzz (ORCPT + 99 others); Fri, 1 Oct 2021 16:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355542AbhJAUzy (ORCPT ); Fri, 1 Oct 2021 16:55:54 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1143FC061775 for ; Fri, 1 Oct 2021 13:54:10 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1633121648; 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=tqUDfDbD+LheVFGVx1ttBWfxP0P88MXIJpplml+x1eE=; b=do2XRzWdyL27M+wQoWjr3T0jjmFvE+88eVrjBxQRJUFagMj4GRfcsSWMJ7p9FaFqMS2Pi6 PMMkx7tHnBpuVV/kikxrdumnOtJzJJF1eNiLqWcSyAkUKXgr+rvX1IatskIgIApzGAmVQI kt/KQj21neRgg/fh04TvmNrgPqYz0HE/GuBqNB71D3AEWx316GKru17f8rRqGpF6ojK30M aKZU3D0E+z0Uyvd9uzczENmSzVf9/5gqJoTohiiSk1v9/4RlYTGh6CIhFxsyC0My7nBHQG vgAB+ylQiyIvW5RyOn9YNa6x6mCguGA3UkGr6GvUDosLI07kwDwmJc7TBuK5Hw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1633121648; 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=tqUDfDbD+LheVFGVx1ttBWfxP0P88MXIJpplml+x1eE=; b=Hl2AoXqTLZ3++Y3lwAO3co4RzsMV4fZWBlW51qebIb3AJcZ3XK5SKxaWZIDYsOFn7B5pr8 Ks5+2yZI+S3CA8CA== To: Andy Lutomirski , Andy Lutomirski Cc: Peter Zijlstra , LKML , Ingo Molnar , Sebastian Andrzej Siewior , Masami Hiramatsu Subject: Re: [patch 4/5] sched: Delay task stack freeing on RT In-Reply-To: References: <20210928122339.502270600@linutronix.de> <20210928122411.593486363@linutronix.de> <87o8884q02.ffs@tglx> Date: Fri, 01 Oct 2021 22:54:08 +0200 Message-ID: <87a6js4gb3.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 01 2021 at 12:02, Andy Lutomirski wrote: > On Fri, Oct 1, 2021 at 11:48 AM Andy Lutomirski wrote: >> >> On Fri, Oct 1, 2021 at 10:24 AM Thomas Gleixner wrote: >> > > >> ISTM it would be conceptually for do_exit() to handle its own freeing >> in its own preemptible context. Obviously that can't really work, >> since we can't free a task_struct or a task stack while we're running >> on it. But I wonder if we could approximate it by putting this work >> in a workqueue so that it all runs in a normal schedulable context. >> To make the shell script case work nicely, we want to release the task >> stack before notifying anyone waiting for the dying task to exit, but >> maybe that's doable. It could involve some nasty exit_signal hackery, >> though. > > I'm making this way more complicated than it needs to be. How about > we unaccount the task stack in do_exit and release it for real in > finish_task_switch()? Other than accounting, free_thread_stack > doesn't take any locks. Right.