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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6620C433F5 for ; Fri, 1 Oct 2021 20:54:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E5D661A10 for ; Fri, 1 Oct 2021 20:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355571AbhJAUz4 (ORCPT ); Fri, 1 Oct 2021 16:55:56 -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.