Message ID | 20230120150246.20797-5-wander@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp257608wrn; Fri, 20 Jan 2023 07:19:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsxwX4k8YtNn1d0+GnlDHfhAerov6eOK4BiYi8VfkxavOOWX8xSw0zMSiXtk58LCOz+LyIT X-Received: by 2002:a17:907:3ea9:b0:7ff:727f:65cb with SMTP id hs41-20020a1709073ea900b007ff727f65cbmr15466488ejc.19.1674227967998; Fri, 20 Jan 2023 07:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674227967; cv=none; d=google.com; s=arc-20160816; b=dQpxMTVCZ+G1jQkvyYfbGMHFfXZ94AQtWwVnQ4KjhYJKQ4KN1jWmQw5bF+J333VKsx 2IpsUKhtbS21kJ31V9lzJuVtMOoa/M6QhaRMjWVBgUx+WPnXG3Qia6q2kXO3lb+0buUk Nr9qHsX+MuK3J6gvOmTwIhNUO2WmD0Y2MGsqFv0DQ7g9nnRD8mGAwikqj5uTy08o9fkq favwQJXo5tzBcvdsEzUXA6tzhVHi8vC5nE7O/bLzOTyfs1DDUGqMHLX22GjJRV0Npke8 wq3beakj1VI9+ZdjpVkRAFX14a10bvojqHZcuoXHJYsio4cplkYYipAehqtzFD4+wJo+ eg4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Lda/+ml5+8vWZrx9vfKLtfMa+7nWIziVhjlRSwPRz3M=; b=KK257+mz1ipFzrdH/k2b7GLHUkW3+K4pCoWaMMoI1GIKC27zyzcC8u/8e5TW6uRgHk goe4fi9bU2P0alOq1rJkc472fNtSWNqyOImI39uK7IPOST9TzlHqY52VE7/5x2Ea1nEi XlMYSZBAP1g02iCE6L8XDoEmAbQv7xs1hTLm5uL4MoU2q7CG+zh9iuiI27yGPoRL0fE5 +Djv06d8W5VAGUVJ0vEvybg8W80979rlA65GXMZsdQ4TY+BUhnzqvfYRrJTFImm3vCeH eTpoDPm5oE0Qh/Ejz+SoIGhYpo9JuOtDG3qyO/YYQ+Zu4J8RE+QCqI0k/wN/IaE8IyXP VDcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dLYPoSVO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw19-20020a1709066a1300b00877a7ce0ec4si1090577ejc.252.2023.01.20.07.19.03; Fri, 20 Jan 2023 07:19:27 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=dLYPoSVO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbjATPEl (ORCPT <rfc822;literming00@gmail.com> + 99 others); Fri, 20 Jan 2023 10:04:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231288AbjATPEc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Jan 2023 10:04:32 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF84B2E66 for <linux-kernel@vger.kernel.org>; Fri, 20 Jan 2023 07:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674227028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lda/+ml5+8vWZrx9vfKLtfMa+7nWIziVhjlRSwPRz3M=; b=dLYPoSVO6rnvIsMAH9X9Bq66MUJXwYdu+oCku7s5I8eIjgZqlH2i4Qk4sN/zS26eSKFlmp VPRd5N6jYbfUGIPrHsmSYUdiM8xU8u4wVhvQLYcUCkc8aI5KRqechgR1B0VeSA/WXxylEf q9+3J5No++34u6JmW4kGpCeojZBK6fI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-bhRqpXYPNP-zoGd957nf9Q-1; Fri, 20 Jan 2023 10:03:43 -0500 X-MC-Unique: bhRqpXYPNP-zoGd957nf9Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43D06800DB5; Fri, 20 Jan 2023 15:03:42 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.32.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7F02492B02; Fri, 20 Jan 2023 15:03:37 +0000 (UTC) From: Wander Lairson Costa <wander@redhat.com> To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Juri Lelli <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>, Daniel Bristot de Oliveira <bristot@redhat.com>, Valentin Schneider <vschneid@redhat.com>, "Eric W. Biederman" <ebiederm@xmission.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Stafford Horne <shorne@gmail.com>, "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>, Oleg Nesterov <oleg@redhat.com>, Wander Lairson Costa <wander@redhat.com>, Kefeng Wang <wangkefeng.wang@huawei.com>, Andrew Morton <akpm@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Sebastian Andrzej Siewior <bigeasy@linutronix.de>, Andy Lutomirski <luto@kernel.org>, "Liam R. Howlett" <Liam.Howlett@Oracle.com>, Fenghua Yu <fenghua.yu@intel.com>, Andrei Vagin <avagin@gmail.com>, linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 4/4] sched/core: use put_task_struct_atomic_safe() to avoid potential splat Date: Fri, 20 Jan 2023 12:02:42 -0300 Message-Id: <20230120150246.20797-5-wander@redhat.com> In-Reply-To: <20230120150246.20797-1-wander@redhat.com> References: <20230120150246.20797-1-wander@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755555265743039390?= X-GMAIL-MSGID: =?utf-8?q?1755555265743039390?= |
Series |
Fix put_task_struct() calls under PREEMPT_RT
|
|
Commit Message
Wander Lairson Costa
Jan. 20, 2023, 3:02 p.m. UTC
push_cpu_stop() is called form a context in which it must not sleep.
Since push_cpu_stop() calls put_task_struct(), it potentially can sleep
under PREEMPT_RT if the usage count reaches zero.
Use put_task_struct_atomic_safe(0 instead to avoid this potential splat.
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c437260e19b0..e5d0c66cb90c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2565,7 +2565,7 @@ int push_cpu_stop(void *arg) raw_spin_rq_unlock(rq); raw_spin_unlock_irq(&p->pi_lock); - put_task_struct(p); + put_task_struct_atomic_safe(p); return 0; }