Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1596031pxb; Fri, 1 Oct 2021 14:24:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX/mWnGYQDt18onfO7jadYQHyxNamIqImcjBcwuhKZOYRqqzrW3scRjxZNerre066K2Tg/ X-Received: by 2002:a05:6a00:d6f:b0:44c:5c1:7852 with SMTP id n47-20020a056a000d6f00b0044c05c17852mr8574437pfv.13.1633123474374; Fri, 01 Oct 2021 14:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633123474; cv=none; d=google.com; s=arc-20160816; b=NJ8zfCwxUcjWgp6OAleG8y5O5+aj6bo1Pgvu+T1vBsDXhnfRdeDQfeZaHC8cL2Id1n 50KVRbEAwRTD1OzjqacbASxeViyH/lQdm/pMn9uxkqZReuD5TJ5iLDhxdxF8tPdchend JB9BZLD6DUFrbC7Q1jHt1nHDlMXfwKFjN38R7xSVrcsMjRDtMvtB6cZFhz3YVzxo8hcH 3MOiIxXHnyIaTUzlevWYRjhgtj03KsivcMgpO8zLSCUGsOT/suoXaN7bt3zsXbV+0WVw tEUfhKe00X+UEa+MLzV9JVhSKKAmYAIsxHgdSwH/10RNs7CqifPwIpnktQfU5KXk29+v JytQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TBhYeDrYeEGaKZ++5cPWE0frwDXaIn3LSn2y1A97E0s=; b=fvbockg6wsDuxo2ZcNZmnshpKBzlygz/hROoXRYCGA1DZlJZQDE/cf9D0/z4CUxaJ+ O0Xpffh62SCOicOtKn3ib4kgWM+nBqiBpeFc7lWSKecRxQ1BjDFbgEW5hrYR14Oyg3vD 8AJl9EsZJKi2pnf5ZX6lKoN+LW9uQOsi/KconA46nppl3tEdT/TQ8p53fWnAiPp9Ahxr tS3Pncsd0dBYujEZzL+6O6NPQduxPcUF1mNGD2ExQnjKmvP9AWTO7duh1w+7rNU/PB0/ WwX8QX/kWACNTDy4rE7Oe0ZvO/dYAGyx2t1YsBQ1w/HSjV1fbHCKFSg/+LAtoKrAe+Wn h1vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Jcsg/VwG"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si9704059plc.260.2021.10.01.14.24.21; Fri, 01 Oct 2021 14:24:34 -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=@kernel.org header.s=k20201202 header.b="Jcsg/VwG"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231734AbhJATES (ORCPT + 99 others); Fri, 1 Oct 2021 15:04:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbhJATES (ORCPT ); Fri, 1 Oct 2021 15:04:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B6D2B619EC for ; Fri, 1 Oct 2021 19:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633114953; bh=EPGyMNhxkP7Yp1ZD9ry009CVJ19Uzh2NdY+aZQeVb9Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Jcsg/VwGyNCVtmLFVUvgiC3JrEVJ9aoysg3jdAhlWp+4zmygK4bAyQYvILd9VCX2h 0IYiuokIMCXvWIGgQVX/pJfAMxyazFELQr6+xrXmDoFVXRbCmo8U/R1d2DHDN56xVv 0Vsb4wGPo+CL6t53jCSWoRE0apiayOZRcXl27rqJfZk6r0objvYeK2dOkALAnMpML7 eD/mE7bLJytbD7DY36i1DTk2GlTT4okBYcc9iDWFseMHosp/LJTQQeuwoj/wqtWCft n0S9ccmDxKM3fv64q7zlMAq5tTCZAsNs4+Insw8Qnm2k69+Dbq55tmyc5joBmdROKV 0gTrmRqbOF3EA== Received: by mail-ed1-f53.google.com with SMTP id g8so38405837edt.7 for ; Fri, 01 Oct 2021 12:02:33 -0700 (PDT) X-Gm-Message-State: AOAM531egRZfIoviv3vOOaILE9KQ2WXpYDE0nfch830GPgFH47Usuf7c YQ5jnKivNPOoiybPTPp7AcniOImKNaaKgTO638o/nQ== X-Received: by 2002:a50:cf87:: with SMTP id h7mr16411017edk.330.1633114952148; Fri, 01 Oct 2021 12:02:32 -0700 (PDT) MIME-Version: 1.0 References: <20210928122339.502270600@linutronix.de> <20210928122411.593486363@linutronix.de> <87o8884q02.ffs@tglx> In-Reply-To: From: Andy Lutomirski Date: Fri, 1 Oct 2021 12:02:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 4/5] sched: Delay task stack freeing on RT To: Andy Lutomirski Cc: Thomas Gleixner , Peter Zijlstra , LKML , Ingo Molnar , Sebastian Andrzej Siewior , Masami Hiramatsu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --Andy