From patchwork Wed Feb 21 09:49:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13565283 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 1A73AC54788 for ; Wed, 21 Feb 2024 09:50:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 535996B0083; Wed, 21 Feb 2024 04:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BFB36B0085; Wed, 21 Feb 2024 04:49:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C58D6B0087; Wed, 21 Feb 2024 04:49:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0440C6B0083 for ; Wed, 21 Feb 2024 04:49:56 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C6A701209B4 for ; Wed, 21 Feb 2024 09:49:55 +0000 (UTC) X-FDA: 81815339550.27.D538221 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf11.hostedemail.com (Postfix) with ESMTP id EAD1640010 for ; Wed, 21 Feb 2024 09:49:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.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=1708508994; a=rsa-sha256; cv=none; b=K95KMVOpHXAWce2I9A1JPQujD86oF9BhF4K/k3NFBOO/BdGOJWPW57uNb+jIkkQFDCUMqo omjLeTq9tzvTDSIf9gpecLbJ3oSb+Jube9uJjUXuLiekueGuGL2Z6NFHnqvxpSPmd6GHrP C/KiYKN7d/m9+DsMBIQG2zMSFK2wncE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf11.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=1708508994; 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=BveDZXyUi+0KphJCZYH/lpxdeY6rjC9WhIaqxXlaGMI=; b=JIBfOFgb6TSysvGSOdAnfzEZf4zrKJwhzw7MJR24JOu/TK++nWOUxar9TEzwnSFvGZEMva Ae0MKLL2qzqdT9F+alsLiQ7ebiWMQNoNY2Fz7qQhPeLx7pI0F0+ZCJgEUO5YvPBz5bCrkY VT+I/fMEyHL5h5gnwqO/vUSmkadPKK8= X-AuditID: a67dfc5b-d85ff70000001748-f7-65d5c7395078 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 v12 07/27] dept: Apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Date: Wed, 21 Feb 2024 18:49:13 +0900 Message-Id: <20240221094933.36348-8-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240221094933.36348-1-byungchul@sk.com> References: <20240221094933.36348-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSWUyTaRSG/b5/pVLz2yHhVy/QJobEnQH0SNToqOG7MZp4YeLEaJXfabVF 0rLIZBzBIjIgLhhaBRSKk1qhLhSI6AhWUKBuFG0ddIAog0sVRNGiLKKtM96cPHnPe56rw1OK OmYqr0lMlvSJKq2SldGy/lDL3MUtXmlB08lwOHpwAfg/5NBQcsHOgvt8JQJ7TSYG3814+Huo D8Ho3TYKzIVuBJanXRTUNHcjqLftY+FB7yTw+AdYcBXmsWA8fYGF9tdjGDpNBRgqHWvg9pFy DM7hFzSYfSwUm404MF5iGLZWcGDNmAk9tiIOxp5Ggav7IQP1j2fDiVOdLFytd9HQXNeD4cGV Eha67V8YuN3cSoP7aD4D596Us/B6yEqB1T/AwX1nGYaLWQFR9vtxBlrynRiy/6zC4Hn0F4KG nCcYHPaHLDT5+zBUOwopGDlzE0HPoX4O9h8c5qA48xCCvP0mGto+tzCQ1RkLo59K2OVxpKl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sBYFGXw8Ghz2PgZ83mhB4c77xcDzLz0PB0RwEp45fYOHJrxYOTF0xMPKjkKxaRht7+hhq chygdUMWlj4skuj9/Dc8NT14zVOLPYk6SubS4tpuTK8N+Dhqt2UQah84y9PMb25Mex8/5mnr xRGWvneb8eaI7Yrle2SdNlk2zF+xS6FxeT5w++snHBz9fSQVVY7LRIIgiYul4YptmShUIOIc qbPTzwQ5XJwpObI/cplIITDiiTFSSX8bCfoTRY30M31R0GHF2VLaq6skyEoxRnp4LB0HWRJn SKV3nP96QsUl0s2CHi7IYQHn+dO7zBmksKAQGwrX6pPj1VpdTLRxnyZFrz0YvTsh3o4Ci7Ee Hs29hwY71jUgUUCqsUpNlVsO49TJxpT4BiQJjCpcyR4InJR71CmHZEPCTkOSTjY2oGkCq5qi XL9N3hUmxqkT5X2yvF82/P9iIXRqKjq/Wm+LSHmmi20frN1hkSO9aHjWrJWfFI2e/iavrheq byXQGgPZXbM0LiSj4Fz9irVtpcOSp5gbH7UkIsO7fQez17am/37i1ljzlmLHZCnkUNTHAVNL RaslujsrdiwzeTo3422Gk3wpzxEvn94QOqnKvzFqS63BWp/U+Wto63wVa9SoF85lDEb1X3Bj TTotAwAA X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: EAD1640010 X-Stat-Signature: njibaj845j4o6rsaizm7bdt65sdjz5mp X-Rspam-User: X-HE-Tag: 1708508993-110533 X-HE-Meta: U2FsdGVkX1+T91HCDkbPtLM1UI4j0oVArzq1/ZqIfC1b5IWjbF+mOBC09lVDmyA6vnAOgai0mam9EVKCKm4yyaqeQvs6KUbzBap60VG+K6TBgGeLskZfdGXR7FcxVNQl/DSbwlnw5ew8uNyDW/AM2DClf3IacWohH4Sm/jCqJF6fpJQhjva4fGATZAnLz7bJGlqoz4KEzCGLZvMU4gSq0I0hXiJbTZD54g6into/bUMjrXHKlM06cuu0KLVU0PEzGsDuBSlpCoAeTwyDk6DUH1KL7Yl/pOLZLKcmFqldNgOhrWJrKEGaNa7a1CxBqUjwKUzyVJn7D4G58c2Los8n0OlHl5PZ/mi8NtVxW+qz/8iiZIDQrbpsH+zlqvF6eiyQhAlpeppAY8r1GYRG+8LPel+q94cNRLbBbdG50z4d8Brk5sBB/FHEm9ScVCDCWJetMQJD33sDvwvlUEEdBR273NME/rBaRm4f0ZVx7PC3bJ+krznEQ9m2Ivio3L03TiJt8eO58ouP7IRro3+ztSUJtzwZC1I8XE3WwToDiPX+PLHh3UlpWT4pCq3HOhaHKDOcguoaRmk+9qjTpWSRk2ZFtaXjOr1GmVfKjH35/pc4F8IM1EF+zh1zJ7582qIl/Ek/bJ51Rx8bxZHx5FFDX93hEgqqEl7HiiMkCWcfmVFrCOOnYbtbCOX0CRCaTcV34hJ7aNuvA9IHcvCM6HoK+EGtT+b7PVTDdrgVuYcjtHANbEHvCo0bj/KSs32072dt0Ggv8oWMhqdYkgwp1mM7hWidJmPqexE7eXBo1PunuKJ40389dQK470hlEiEt0YRjaop9xwE52ANQ7ie7xmFxuKqk00fIEINYWpm71Nhu/YdblA9kKcyiLwM+y8kzwD/PXNmxKX2puHSrGlQD2ehHp7t2BMSnw4ZM025XKwCoa8wdfEAlL4lEM9rZKCCVQ+fmuNhcxAVtUcst/z14PUo9N91 ZKQdqHLp eDrrxZQul4IMK5Ew+fdQrUVBVOQtX/7GGnfWaaESuFbGsLC13PVDFMd+QgzCfMFXRGI8KSEM/VoEqzvgj/hvn2OAtcr6fGFOyaK8zLDnAsqbg0po= 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: List-Subscribe: List-Unsubscribe: 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 fb2915676574..bd2c207481d6 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);