From patchwork Mon Aug 21 03:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13359061 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 8189BEE49AB for ; Mon, 21 Aug 2023 03:50:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 730048D0006; Sun, 20 Aug 2023 23:49:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B9A794000A; Sun, 20 Aug 2023 23:49:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E8CB8D0006; Sun, 20 Aug 2023 23:49:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EE7E694000A for ; Sun, 20 Aug 2023 23:49:50 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CA6391C9280 for ; Mon, 21 Aug 2023 03:49:50 +0000 (UTC) X-FDA: 81146732940.06.AF71F4D Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf05.hostedemail.com (Postfix) with ESMTP id F311D100002 for ; Mon, 21 Aug 2023 03:49:48 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.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=1692589789; 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=vdWikqPpytaqTMcSXbH9cGCmEFmwkLJaDv8QFZ+aP3NIbo6XHC/EcKzzMXzWjjNZ9u0KII U8uBNDRq3kxABswrnWGMGe6z6ApOH8yQ1j/2/LAdSOXzNgDliB+JKaT8ynIXnciPxPALbX soNZJ5T8Xieg6rFgyzeseJRBTItRITs= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.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=1692589789; a=rsa-sha256; cv=none; b=BHW8NZ82SjsIqgkto8dYO2B5AX1P60OpChNTcOTQq8MlvLT6jchU2m0oEjPi06DpUsQ8I1 KIw/3Vt0TtAFdbekhcoU+M6UcRWVhAS2lWK1kbz5MrrFdlWO8mydvS3PQd6QmOnGtg3u1e uIMieBW0EMkvGUJ8Np5yET97n1d/sow= X-AuditID: a67dfc5b-d6dff70000001748-5b-64e2ded5f456 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: [RESEND PATCH v10 07/25] dept: Apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Date: Mon, 21 Aug 2023 12:46:19 +0900 Message-Id: <20230821034637.34630-8-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230821034637.34630-1-byungchul@sk.com> References: <20230821034637.34630-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSbUxTZxTH9zz33udeKiXXTrOrzIlNyBaX4UvUHI0xEkn2fHEhWbZkGsVq 70Y3KFgExcxRpL6BGGqCdYJLgVkrdAoXljC0roPxNiNWraww7EaHTgaIUIsi+FLY/HLyy/mf 8/v0FxhNE7dQMBj3yCajLk1LVKxqJLrigzuBoH758Ng7YD2+HMKPj7JQfslFwHuxBoGrIR/D YOuH8PvEMIKp6zcYsJV6EVT032WgoS2AwO08SOD2QAz4wqMEOkuLCBRUXSJwc2gaQ9+pkxhq lM1wraQSg2fyHxZsgwTKbAU4Mh5gmHRU8+Awx0PQeYaH6f4V0Bno5sDd+z58+10fgSvuThba GoMYbjeVEwi4XnJwra2DBa+1mIMfHlYSGJpwMOAIj/Jwy2PHUGuJiA6HXnDQXuzBcPj7Ogy+ nssIrh79C4Pi6ibQEh7GUK+UMvDsfCuC4IkRHg4dn+ShLP8EgqJDp1i48bydA0vfaph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 2kBDhb8dQ7mUTcCPk7cQeDN9DKTu62Ygd2cmgr2ph0io/VlFQUpTGPR8t9Lhs4WK9k5CSCnf LDi7CkjhTiEvXMp5zggp154yQoG0SSi3hwpFV1uxcOyznxKk4j20IH0+wAgZvnosdNTUMMLt wz2k8LregpeMWCmboxa1mgRRP2VepCy6zelj4q4P3pLnuckkIcfADBTE8twM/suHCqbPNDee f/Kkm+hzMDeKLze9pTKQjCW43f15+8f7dF8whNPxjSeS/prkxvLnzeaAWVbOhfHmLOLf5ki+ 5Kzrr4O4mbx05TLqsyJQ+dTyisxCsgLUrxgFa2ITYlQabdhkw4ZoY6xmy+S1uhgJBX7Glthr voi+1kW4Ecci5QB55AivWkGpEgzGGDfiWUIZLA/51qJWyNUq41ZRr1uj36QVDW4UwpLKYfKF y8RIBRelihc3iGKcqP+fYjZoeBKaH56o+0B5l6403Sua8OKVlP8i5JRnvex4pnX1Nps7XDYs rqN3QXbNiinPojY3rtG7+sdsz5i5pBg7jPPT8XLL0B2+Ew0RiXNTfW+1Z1aV4dwFYzaOvrAi 9ODckzeiRrfdyNftqXq4blBD4puj0zWzhvCD08YdzslsrXXHm2bZjasmHFWShmjVtFBCb1D9 AXJoOr8vAwAA X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: F311D100002 X-Stat-Signature: wf84wmwiwomxqmu7n19qm7tww9sqmjtr X-HE-Tag: 1692589788-955263 X-HE-Meta: U2FsdGVkX1/Hy/+hverqOf8T6IHoLTCelVLQks66cOW/qfiQ9CocV+Om4oUkyQjBqyv+ZBQHVFK2RFtvT6/mwwJUMFWUXFtZjvr9OFefzUcfbqhZb93r19czDgA4ouH4C7uKXyLTsxrV6ynUJa2AgX1Q+bwZ1rIQZpVTkZVf34803OVfB/KZO879fXt8yT/4N+wa/pX5Rd+QXvJkRt1e1W9wusqt8OAxrrIkB87x5dR57mGNNeGLfEvtkvaRftrWagchjNxuGr6hlz4VwSzhvjS757vFP4yRPsemDZPQp/TbklxkrxgAqAxL3uTH7HbAXAc5fSgld+yiHasQJ5YugIT5/NAym4dXqfpkiCNfKEd+hr3Qf0GG/rwfpRiui517rlNUww3/h5Gw1o0Ff314Wo5cJRBtIWIeTZGmWS0JVqtE5MLySIUM2olPly+j4bmLaf5llmBTguJ/FcwP8amjFBBzJuNm9pju4R6Tt/gdtUpSMOgelEwUb3RrAJVD2l+1mjDgz7EkbMfyR0Os8F4EjD3xYmgItl8IAUoOynID2c+W6CBWAjvIwNbGFWGfHn6fEOXKQ6r0oW5r8ZJkIJDF6Y7NPfkUzz9mvKy8uxP+YfeG/iJFqd+4fn8SyvuLLjUKI9VwG8qmCOcENaq+gwilzUd7xJDuYH+qieG4/BwkUlp21Ppa+2Q/CcSOFQRyWSO8XaqgASN95Oay3lTLvVe1+pliWouWzZ6ILLXzCiULgQxLgzR7YrbTp7DYxcY78iLUnnPjYGLdG9VMfcSuqBYfvVhZfsbNGme7TI3Q8cgMfBGztBr+dZOzoM0BiAp1xUZ3B7SsYVywWvTk/rHsRe5oj+3nzI1ju2uTEx+hyZHQozqJcfP/hsJ2SDVwm0qSfo3eEbD89ZaawybmBNmailDjhEOmvei3WBdCtSCVJMX862f7zH1EPnGLeeoZks2O6vh1veSJ4+A6n7Z1fIPQ04u A3Vl1C+R EidAjrKEKa1uDABTouvYt7ARw8++LXC+Bk21kSUcwMI3XS4l6cCKwoaTmtV3NpWrssv3ofnsJGqxfIXKkiWLqHrSyDkv/blS097irAZUx1uDEIkE= 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);