Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp311635pxp; Wed, 16 Mar 2022 06:23:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1MYFXSAsw0JhozuGkbjIx1INKMmvycgubWms8DYFdxtOMaxdcqe9nrgxlCKI8Bm5MX/it X-Received: by 2002:a17:90b:3506:b0:1bf:3dad:aebe with SMTP id ls6-20020a17090b350600b001bf3dadaebemr9987809pjb.235.1647437032337; Wed, 16 Mar 2022 06:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647437032; cv=none; d=google.com; s=arc-20160816; b=HuC1o2AxxtXvnECmFXeOC4qfK0dEARrXwKTioKbsGjVkNSgdPPyUb+8XMawgUlSSOd Y62VsyhJlOXtq10gDl/hO+DripKA8j+MNBbxXPUao57cXGgYTayTrTcX6+lH5pSTMD22 r38OKVM/d1H40ZnQFD6Ia349KaxCPM0xc+I5yeBTBuH78CPv7HV+pEs+Ns5srTFh35dA WG3GqQjs/5eMcl5m/9N4FxWcPl0Aq20yVOd+nXq06q3s8NgEMRvpwZ8BrZIyupuC4MDC cjGN9DVXcLJk4PLsYgcZI+vJBvZ9mUJ+/vZqotdXg52zbcyxA3d70ENmOVRLGU5goIo6 zuYw== 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=AAJt8dQPkZoXu4tC1SGYNAYCw/5M35dfEIpxT733c/P2HyhmzewvMG5yYg7qm6b0oR xujsD8oHNvVb1E354lK4c3EqcScVvIhUQQFCHn9tEYwwXJVeinBqtWiH5RDZgSZHLlQd VnwpvoxnWx1JZrPiHYA1WmiOxVf5Wiz6YMLMPkoaGsW+D0QhBL1s73spOc3E+Hf+RPYu 0QQ2dSTkRUMMn0Xo01Mipk8UKMol3kN0E0GoUTLaXtD9DDyHjntcA9BPrSIlnQY7jrPf APR32GS4pjr52RHrjkDIa0nKjerrgNTxhDzaKT2sGehxzgK0PGm0LsHa0iR/9YQ94Wqh K9IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 t85-20020a627858000000b004f769b40ba9si1920752pfc.150.2022.03.16.06.23.35; Wed, 16 Mar 2022 06:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352948AbiCPC3z (ORCPT + 99 others); Tue, 15 Mar 2022 22:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239046AbiCPC3A (ORCPT ); Tue, 15 Mar 2022 22:29:00 -0400 Received: from lgeamrelo11.lge.com (lgeamrelo11.lge.com [156.147.23.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73B395EDEC for ; Tue, 15 Mar 2022 19:27:12 -0700 (PDT) Received: from unknown (HELO lgemrelse7q.lge.com) (156.147.1.151) by 156.147.23.51 with ESMTP; 16 Mar 2022 11:27:11 +0900 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: byungchul.park@lge.com Received: from unknown (HELO localhost.localdomain) (10.177.244.38) by 156.147.1.151 with ESMTP; 16 Mar 2022 11:27:11 +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 RFC v5 13/21] dept: Apply SDT to swait Date: Wed, 16 Mar 2022 11:26:25 +0900 Message-Id: <1647397593-16747-14-git-send-email-byungchul.park@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1647397593-16747-1-git-send-email-byungchul.park@lge.com> References: <1647397593-16747-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-ext4@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