From patchwork Mon Jul 3 09:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13299821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3922C04FE2 for ; Mon, 3 Jul 2023 09:49:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 674978E007C; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AAE48E00A8; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29D948E007C; Mon, 3 Jul 2023 05:49:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E8F888E00A5 for ; Mon, 3 Jul 2023 05:49:48 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BC08280897 for ; Mon, 3 Jul 2023 09:49:48 +0000 (UTC) X-FDA: 80969828856.10.7E55E0F Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf18.hostedemail.com (Postfix) with ESMTP id D4E941C0003 for ; Mon, 3 Jul 2023 09:49:46 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf18.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688377787; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=1StrxiJxnfIog1Mu4omcy0uRqYka5+9bBl5OVrHzIJk=; b=RiB6lGMxTW2NOk3/lSmF23ObObYBijVoQxqTzLmRn/hoNB3KYxkOtl/xSjfNw66cZYqdk+ Ed0gPX90z4tFjevqx4lWM1l6BjuQNlMTREdaHWPM6fYbwGgXg6mV5fVtdqt/8wmmSYpAvd Hli+tj1L0brnRCq4k22ItpJa810Xuyk= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf18.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688377787; a=rsa-sha256; cv=none; b=Ug0LHnXMV7FJpzNyhKxMv4GBmWIMUe6BM2e8Ie587iDeOM8FLTP/PoMDOJVONUMH9Ey2xx d6dp5wWFbNNMHKO4oirXf2skZ0uU8ApNUKXLz5U2YLBf7DasSyXcjLoPD87cftMwwHXfJ7 DJS3vJHepbfA/DPwPSh5h+VdBD473kw= X-AuditID: a67dfc5b-d85ff70000001748-46-64a299b2c9a4 From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: kernel_team@skhynix.com, torvalds@linux-foundation.org, damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, 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, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com, 42.hyeyoo@gmail.com, chris.p.wilson@intel.com, gwan-gyeong.mun@intel.com, max.byungchul.park@gmail.com, boqun.feng@gmail.com, longman@redhat.com, hdanton@sina.com, her0gyugyu@gmail.com Subject: [PATCH v10 rebased on v6.4 07/25] dept: Apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Date: Mon, 3 Jul 2023 18:47:34 +0900 Message-Id: <20230703094752.79269-8-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230703094752.79269-1-byungchul@sk.com> References: <20230703094752.79269-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSbUxTZxTH9zz33ufedlavlekzNdM1cRqM77CcLWqMX7zZZuJiSLaZTRt7 I90KmoJINSZVwBcEIkyovCktpuugm3KLEV/KOlQUVKjYICNALBEVoeLQory42WL8cvLL+Z/z +/QXGO1lbrZgTE6Vzcl6k46oWXVoin2JUuwwLG+wrob8nOUQfnmEhbKzbgL+P6sRuGsPYOi/ vgHujwwiGL/TyoCt0I/AHuxmoLaxB4HXdZDAvYdTIRAeItBUeIxARuVZAncHJjB0FRVgqFY2 wq3jDgy+0ccs2PoJlNoycGQ8wTDqrOLBaV0Ava4SHiaCK6Cpp50Db+diKD7VReCKt4mFxrpe DPculRHocf/Pwa3Gmyz483M5+OOZg8DAiJMBZ3iIhzZfBYZzmRHRoRf/cXAj14fh0JkaDIF/ LiOoP/IAg+JuJ3A1PIjBoxQyMPbbdQS9eSEesnJGeSg9kIfgWFYRC61vbnCQ2R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v YvAPPEDQdOklBtnRx0JraAKDSy6kYLG6DcFo3iQHF64ucFB6Lg/BlQvXaej56zEDOYPxsPTO yn61k7ROTFEkx3WKeObKadJZKZL7JUMcyWkKcKRcPklc9s3k1sMgJhXTIYbINT+xRJ4u4Mjl ST8mb7u7OdL+2xJNxvxFeM+niYov9FKKMUMyxX6ZpDCMeya59EerMst8v3PZyL3iMoriRWG7 6L4bYCLMChvF/v4FKsJqIVp05b4O5wqeEn78ULT/+YSNFKuFTHFmvuk900KMWFwwhSOsFOLF 5T4H/Z90nVjrbH4vihISxFfv8lCEVeHNYPEwew0pytEHNUhtTMtI1RlT4reakw1ZacbMrUeO p8oo/DS2H5bzG9Bs7+4WJPBI+5Gy/0yFXsXoMsxZqS1I5CmtWmkZualXKfW6rNOS6fhh08kU ydyCPuFp7Vrlt/ulJJVwTHdCSpakdMn0f4v5KE02cq7ZV/v1lslOxdL8ITFTLD1brQxqDq0M zFbvjf4laZ2BCezN9388dFDj6bSquxMbY7vXnj86Lfvt3wxs2vXadiNhTzTxFgg7fJqzzjV9 L1421NVbFxuPVZVsiB1wz/fvMqyaWd36uanw3vY2NZ8tl/zsTV6//kB6leW22RVcTHJqabNB t20zZTLr/gX+XJbcMAMAAA== X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D4E941C0003 X-Stat-Signature: yw1yizb8g8kzcowy3wq54hna9ddp37ew X-Rspam-User: X-HE-Tag: 1688377786-306430 X-HE-Meta: U2FsdGVkX186WPT9wactubBmjZROnh5X6Rd2mFMba5koO0UV6zwzSH16vzq0UYfiHu3BBwIxpnx+WZdGDKx+EZTMqaS1wRdkv2NxXyqoDMMMEapreyCfhckDVGw3TjE5aH+WwfnwvF8luVTLJXIhwfuhWvzEjClQ8YJd2SHCzEudDFj1VQLrdylFguNQ+vbeM7ah+ejXKDRY2CUEgqLNWk5S4qFNMXZWrUHKOjP3++O7wcnuscwKY0w1j3ZuFuYb2szvGKQOK04/3EQ9klQWaalyjQwzCiWG5cas+LlYZ2cWdQhvTx1HTVsKRES3evA0uNe4DclsQP7zDoWbGmhA/+kJfiB748N3TOFmpz1swOh+0t8xqR/2A4MQ6EezZi7+CHxWlOBhkT3zVXRzrLnjpY3Us75DKXCESUS/8Zbkt0xNWQhWitC6mKM80+qV5S4sbyjSPLUaac0OCFo4lGB6MAe5xmjzuuScwLJjSidwtUHZqcnWxpFF8UHqJBCU4LqJJ6142jQmvq56wfhRExYMqNQGq8x+HIHMGjsYbfTZV54dDw4mheH5fDYnF09L7+OoEPz8jUfftvoYPR1uAV2HrcTraHbWn4Rz4mOHQDaMlUzOC5wq+oM3ev3HcQXFWsd/MBMGCMox01ha0kzgvQZSogM1neYuRB1C3rZXK79AZKuJydjxhBZtzEwiZQS0VWhVxQeyAJz0Z1nq6ZkIc7P+gkaAWAt/4o2BZXfK5WfJp3gOxUJ00hg89cBT46YD1tu37wE4b4Mb4zPhM201VrRoU31QGkgKp6pLcoa1s6TK7sxij8+tbua+yDV3aeWVIG5ewM3APE3rz+/yLGO7ebqXG3wjPLgmuI5/+liK5jTsWOsJPW69hRDjuFSJy8c9FDsBWBicRcdttqCIX/V0gterba3lSgnTYa8x6gE08m2DhhtWm9skSi39QLHZ+q1dVIdfHlHLAgAC0qhe/6iGLJB qXVd5EdO g3rs6FxfhwxwRowR0RWk9QzFwpf9qqo6w/4gLHbgRae+fjn9bqQYE1FNlso1QsWj9aVWoqnNnlf7kXd/NUEZNBHKM46xFbYcJ5XqLxfyVoiWbwsU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Makes Dept able to track dependencies by wait_for_completion()/complete(). Signed-off-by: Byungchul Park --- include/linux/completion.h | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/include/linux/completion.h b/include/linux/completion.h index 62b32b19e0a8..32d535abebf3 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h @@ -10,6 +10,7 @@ */ #include +#include /* * struct completion - structure used to maintain state for a "completion" @@ -26,14 +27,33 @@ struct completion { unsigned int done; struct swait_queue_head wait; + struct dept_map dmap; }; +#define init_completion(x) \ +do { \ + sdt_map_init(&(x)->dmap); \ + __init_completion(x); \ +} while (0) + +/* + * XXX: No use cases for now. Fill the body when needed. + */ #define init_completion_map(x, m) init_completion(x) -static inline void complete_acquire(struct completion *x) {} -static inline void complete_release(struct completion *x) {} + +static inline void complete_acquire(struct completion *x) +{ + sdt_might_sleep_start(&x->dmap); +} + +static inline void complete_release(struct completion *x) +{ + sdt_might_sleep_end(); +} #define COMPLETION_INITIALIZER(work) \ - { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait) } + { 0, __SWAIT_QUEUE_HEAD_INITIALIZER((work).wait), \ + .dmap = DEPT_MAP_INITIALIZER(work, NULL), } #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \ (*({ init_completion_map(&(work), &(map)); &(work); })) @@ -75,13 +95,13 @@ static inline void complete_release(struct completion *x) {} #endif /** - * init_completion - Initialize a dynamically allocated completion + * __init_completion - Initialize a dynamically allocated completion * @x: pointer to completion structure that is to be initialized * * This inline function will initialize a dynamically created completion * structure. */ -static inline void init_completion(struct completion *x) +static inline void __init_completion(struct completion *x) { x->done = 0; init_swait_queue_head(&x->wait);