Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1902105pxm; Fri, 4 Mar 2022 05:48:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwW0bDizF2tkdDY+st4l112HW836x/LVvW+VGbNb1dSeFsClmPHwq+gbZrJKbe4pBrFjSxZ X-Received: by 2002:a17:902:b692:b0:151:5474:d3ee with SMTP id c18-20020a170902b69200b001515474d3eemr30253403pls.139.1646401736549; Fri, 04 Mar 2022 05:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646401736; cv=none; d=google.com; s=arc-20160816; b=raS94TTK3qHZ7ALgmfjBRy1/bzXT5fwR53SCiJqwAZmUL8sJRWn2LvZupaX5DEG/GG zGnIN1KM9km8Bv8thcsVPB1MBmItrpjezwBRmksySb2E7/AYbVRr6FfbQK4RHwyNgnBy RdTBYJHAYFNi1FVmjdGSslJ1EIKWsJNxSQtwUpgALBwdf7OjzlfFPOaXdHFSwoNnm/5R cZY2ZW+PVwLRKrYsswrzC4Oyz+mTc9CQPX1dgs77Y4oyZ2h2KJub6sTmS2X8C/UvSjdO X+EV33u6xUp2hb4DutylMnZeM0Me1A/7FzNM/I0hS36mgl7evnAWWS2ZSvGPmta2K6V3 dlFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=Xzmk7RzuZ/NauBFmShbevwf/OifwyxIcQpkL1pt9pds=; b=LdTwcxbgE/33iO+j8SlPGoVuOB6tWn5N4PFv5GEAI+bYskEdpVGDWi+qHrnX6VoFWS BgkIAc3vph9UBMQvrbKPGju8509LnRg0LAUBeRIohiXmPsD+Z7OxmExWuwNwhUMJFMTH 0u1rtRNvWYkduEVIdNIMtlnpECSO/akQYghcp0rGxaBWuorNgSQ2G2zQ4tanUnTKofYU C7ai8uof2/Z23TMLKrvHiYkTVFt0FiSYmgZtFuPJDSq1+rGlSJlSn96NMIDDYNKJoJca S1AMdjU9rTyeT2W649P8HBw9vE8FVakIW5plfOx9saM+LIHm04UaQHmjCF6eo8v7Ec7j Zz5g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a170902e8c900b0014daa132f6csi5166854plg.589.2022.03.04.05.48.35; Fri, 04 Mar 2022 05:48:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238863AbiCDHKM (ORCPT + 99 others); Fri, 4 Mar 2022 02:10:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238723AbiCDHIt (ORCPT ); Fri, 4 Mar 2022 02:08:49 -0500 Received: from lgeamrelo11.lge.com (lgeamrelo12.lge.com [156.147.23.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FE84190C24 for ; Thu, 3 Mar 2022 23:07:09 -0800 (PST) Received: from unknown (HELO lgemrelse6q.lge.com) (156.147.1.121) by 156.147.23.52 with ESMTP; 4 Mar 2022 16:07:08 +0900 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.244.38) by 156.147.1.121 with ESMTP; 4 Mar 2022 16:07:08 +0900 X-Original-SENDERIP: 10.177.244.38 X-Original-MAILFROM: byungchul.park@lge.com From: Byungchul Park To: torvalds@linux-foundation.org Cc: damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, chris@chris-wilson.co.uk, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, bfields@fieldses.org, gregkh@linuxfoundation.org, kernel-team@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org, minchan@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, sj@kernel.org, jglisse@redhat.com, dennis@kernel.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, vbabka@suse.cz, ngupta@vflare.org, linux-block@vger.kernel.org, paolo.valente@linaro.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jack@suse.com, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com Subject: [PATCH v4 14/24] dept: Apply SDT to swait Date: Fri, 4 Mar 2022 16:06:33 +0900 Message-Id: <1646377603-19730-15-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1646377603-19730-1-git-send-email-byungchul.park@lge.com> References: <1646377603-19730-1-git-send-email-byungchul.park@lge.com> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Makes SDT able to track dependencies by swait. Signed-off-by: Byungchul Park --- include/linux/swait.h | 4 ++++ kernel/sched/swait.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/swait.h b/include/linux/swait.h index 6a8c22b..dbdf2ce 100644 --- a/include/linux/swait.h +++ b/include/linux/swait.h @@ -6,6 +6,7 @@ #include #include #include +#include #include /* @@ -43,6 +44,7 @@ struct swait_queue_head { raw_spinlock_t lock; struct list_head task_list; + struct dept_map dmap; }; struct swait_queue { @@ -61,6 +63,7 @@ struct swait_queue { #define __SWAIT_QUEUE_HEAD_INITIALIZER(name) { \ .lock = __RAW_SPIN_LOCK_UNLOCKED(name.lock), \ .task_list = LIST_HEAD_INIT((name).task_list), \ + .dmap = DEPT_SDT_MAP_INIT(name), \ } #define DECLARE_SWAIT_QUEUE_HEAD(name) \ @@ -72,6 +75,7 @@ extern void __init_swait_queue_head(struct swait_queue_head *q, const char *name #define init_swait_queue_head(q) \ do { \ static struct lock_class_key __key; \ + sdt_map_init(&(q)->dmap); \ __init_swait_queue_head((q), #q, &__key); \ } while (0) diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c index e1c655f..4ca7d6e 100644 --- a/kernel/sched/swait.c +++ b/kernel/sched/swait.c @@ -27,6 +27,7 @@ void swake_up_locked(struct swait_queue_head *q) return; curr = list_first_entry(&q->task_list, typeof(*curr), task_list); + sdt_event(&q->dmap); wake_up_process(curr->task); list_del_init(&curr->task_list); } @@ -69,6 +70,7 @@ void swake_up_all(struct swait_queue_head *q) while (!list_empty(&tmp)) { curr = list_first_entry(&tmp, typeof(*curr), task_list); + sdt_event(&q->dmap); wake_up_state(curr->task, TASK_NORMAL); list_del_init(&curr->task_list); @@ -97,6 +99,9 @@ void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue * __prepare_to_swait(q, wait); set_current_state(state); raw_spin_unlock_irqrestore(&q->lock, flags); + + if (state & TASK_NORMAL) + sdt_wait_prepare(&q->dmap); } EXPORT_SYMBOL(prepare_to_swait_exclusive); @@ -119,12 +124,16 @@ long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait } raw_spin_unlock_irqrestore(&q->lock, flags); + if (!ret && state & TASK_NORMAL) + sdt_wait_prepare(&q->dmap); + return ret; } EXPORT_SYMBOL(prepare_to_swait_event); void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait) { + sdt_wait_finish(); __set_current_state(TASK_RUNNING); if (!list_empty(&wait->task_list)) list_del_init(&wait->task_list); @@ -134,6 +143,7 @@ void finish_swait(struct swait_queue_head *q, struct swait_queue *wait) { unsigned long flags; + sdt_wait_finish(); __set_current_state(TASK_RUNNING); if (!list_empty_careful(&wait->task_list)) { -- 1.9.1