Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2783610rwb; Fri, 20 Jan 2023 07:19:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXv9/8apmxjFrYCti8i/5HaLsQzPUzsUb25aT0rP0Znp0Shipi7a5INUzUuIFqFXOrDRN/8r X-Received: by 2002:a17:906:6313:b0:7c1:6151:34c0 with SMTP id sk19-20020a170906631300b007c1615134c0mr16409916ejc.6.1674227960888; Fri, 20 Jan 2023 07:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674227960; cv=none; d=google.com; s=arc-20160816; b=KJObEPgk4Dvxru0NXsdF0TzF5ADSvTH6WG3XW8fPuyRQIvluWFUk+XodJiRvKyLtI+ Lr2ofTycnW+ouSrLqIyD0IWZ9HzgkxkS+6itf9vzpVG0gndyGK7VwyPOWlP0eLu7r1pG fl50Sw66KU1KuEOhGA/Q47hAf1Xu/l1/JSvUWECRr9uYoBf4y3sN9FUj576z5YXlEvTi 8mKiYEgROK7BtYdaptlxrjZAJj0+ZIeXegXVvQ8JP1b+FO++sgwrqi0con8jKvwnNRIX L9sWDnXLLQAc5cI5WBeeQ6+Y4l+b2L+/3SyGTyq/+pvdJVT4VfQSUu9ZUME8RtnyWxRF Y6IQ== 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 :message-id:date:subject:to:from:dkim-signature; bh=TLOWCWdvP7Mw76tPsWEdql+JcbZ7sGhlRjsTCSJjmvg=; b=JdqN8zaop3sqnv7ZHqUOTU8E6vfXouVa9Rgjw9EFt9t5ShMaUlu1dJBjwBlmrinZhI aggLd62RJf/OTDXUG2B/dt1LywBwUCqtOePv/CofEI0nqm7A6zhsKhqmX2rN/5l5mNa6 VNCg8S11D+mAFm0BTN4QyEMFxO8eC8hELhcTzCD060owQ1ujDoq4Xtsg+yxgy3PgQybC FNd8NSArcvNlnQWjQYA3r4AQq19hExm+HCkJo6Z645gseHQTIuqJwP4sR7j3R15wA1zi jrKg3SMK7wxu7DCQu9GUmTzqaASSRQN1j3ZFvvNXx+00UzSe7KbOhOVRQqzm2MahcaHi YyfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LmO3mcUN; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xi5-20020a170906dac500b007ae1874c142si12221354ejb.446.2023.01.20.07.19.09; Fri, 20 Jan 2023 07:19:20 -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=LmO3mcUN; 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 S231189AbjATPDw (ORCPT + 49 others); Fri, 20 Jan 2023 10:03:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbjATPDr (ORCPT ); Fri, 20 Jan 2023 10:03:47 -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 2DC6F10415 for ; Fri, 20 Jan 2023 07:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674226983; 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; bh=TLOWCWdvP7Mw76tPsWEdql+JcbZ7sGhlRjsTCSJjmvg=; b=LmO3mcUNVwkmHPMiaZus5+7zCqkDxiEvaKcrS6HADfWztLdA4xDoYvFKK9+9ZeiCkRZoYU 6chljr8Ooshh5Jr1kWwm8f6f2SBVEgWdDgCCJ1wgf6ypen96oajxljHS79vCAE9Z0FGn8m tovnZ9TOdfXMQFrub6g/uKLG9jNMds4= 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-64-1g2HogO0Psi3wtB4CLFcVA-1; Fri, 20 Jan 2023 10:02:59 -0500 X-MC-Unique: 1g2HogO0Psi3wtB4CLFcVA-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 8BF1B8030D0; Fri, 20 Jan 2023 15:02:58 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.32.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id C83CC492B03; Fri, 20 Jan 2023 15:02:52 +0000 (UTC) From: Wander Lairson Costa To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , "Eric W. Biederman" , Geert Uytterhoeven , "Russell King (Oracle)" , Catalin Marinas , Wander Lairson Costa , Oleg Nesterov , Kefeng Wang , Andrew Morton , Thomas Gleixner , Sebastian Andrzej Siewior , Andy Lutomirski , "Liam R. Howlett" , Fenghua Yu , Andrei Vagin , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 0/4] Fix put_task_struct() calls under PREEMPT_RT Date: Fri, 20 Jan 2023 12:02:38 -0300 Message-Id: <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: X-Mailing-List: linux-kernel@vger.kernel.org put_task_struct() decrements a usage counter and calls __put_task_struct() if the counter reaches zero. __put_task_struct() indirectly acquires a spinlock, which is a sleeping lock under PREEMPT_RT. Therefore, we can't call put_task_struct() in an atomic context in RT kernels. This patch series introduces put_task_struct_atomic_safe(), which defers the call to __put_task_struct() to a process context when compiled with PREEMPT_RT. It also fixes known problematic call sites. Changelog: ========== v2: * Add the put_task_struct_atomic_safe() function that is responsible for handling the conditions to call put_task_struct(). * Replace put_task_struct() by put_task_struct_atomic_safe() in known atomic call sites. Wander Lairson Costa (4): sched/task: Add the put_task_struct_atomic_safe function sched/deadline: fix inactive_task_timer splat sched/rt: use put_task_struct_atomic_safe() to avoid potential splat sched/core: use put_task_struct_atomic_safe() to avoid potential splat include/linux/sched/task.h | 21 +++++++++++++++++++++ kernel/fork.c | 8 ++++++++ kernel/sched/core.c | 2 +- kernel/sched/deadline.c | 2 +- kernel/sched/rt.c | 4 ++-- 5 files changed, 33 insertions(+), 4 deletions(-) -- 2.39.0