From patchwork Mon Jun 26 11:56:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13292768 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 782F7EB64D7 for ; Mon, 26 Jun 2023 11:58:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8C4B8D000A; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B387C8D0009; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98B978D0008; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8A1D08D0005 for ; Mon, 26 Jun 2023 07:58:46 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0B2B81A04DB for ; Mon, 26 Jun 2023 11:58:46 +0000 (UTC) X-FDA: 80944752252.18.40E99E6 Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf22.hostedemail.com (Postfix) with ESMTP id 0C0D8C002C for ; Mon, 26 Jun 2023 11:58:43 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687780724; 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=RtAlj/ZyNAZ524BLqgfeiGHi520+o43EqSelHdxtdS4/OlrMo9Ad9zD8isjCeS0pLnLFy+ DLCOfZNhtU1JBIcv+QASpkzRq0L9+IAWWtoHTYfDgocVbTbIPz4PDSSAPFBOJZdtxzVGdi N0cQBLkRR0DtuVd6B2eW5yajiecDvBs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687780724; a=rsa-sha256; cv=none; b=iTjh1JbHgYMPhhNE23WTMWuY75GioCAl3qfcBjN3N+5L0BfmycMebJgc0JZU46VgqR08ey 6OL22S+ExscO+HZX44765UpCm1KLRGYQQi6L/WH/teiSmuvtSubXdv6z5ViHiRLhnQZlZI j+wqrObO86p96qCPJ479DuZHxcgOA/U= X-AuditID: a67dfc5b-d85ff70000001748-fc-64997d6b187d 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, paolo.valente@linaro.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 07/25] dept: Apply sdt_might_sleep_{start,end}() to wait_for_completion()/complete() Date: Mon, 26 Jun 2023 20:56:42 +0900 Message-Id: <20230626115700.13873-8-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230626115700.13873-1-byungchul@sk.com> References: <20230626115700.13873-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0wTWRSAvXdm7kwrxXHQdUSDpgaNbBZxRT3xHU10YlyzCf80Zrexk21D qaZIAY0JVDSKgA+ClYeKZVMQWMWCikKRRXn5oi4EqanNwpqFCkiCFq3go9X45+RLzne+X4ej hCYmktMbD8gmo8agJkpaORpm+8lwuFAb1/FfGJzJiQP/2+M0lFyrJuC6WoWgui4Tg691Gzyb GEEw+biLAmuBC8Hl/hcU1LV5ETgrLAS6X4ZDj3+MQGfBSQJHyq4ReDo8hcFz7iyGKscv8PC0 DUNzYJAGq49AsfUIDo4hDAF7JQv2jGgYqChiYap/OXR6exlwPv8RCi96CDQ6O2loqx/A0H2n hIC3+jMDD9s6aHCdyWXgr9c2AsMTdgrs/jEW/mkuxVCTFQy9mnJiOPbmEwPtuc1B+vM6hh53 A4Km4/9icFT3ErjnH8FQ6yig4EN5K4KBvFEWjuYEWCjOzENw8ug5Gro+tjOQ5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bYGCoojdM 137FMPlnD4K75c8xOOxTLPQHFjA4HTUU/H/9PoK5ykUOyi4FOWgorkRwsewqDeOvhxgo9SbC +lojeyCZ9C8sU6TUmUfcqxaa/GYVye36ZxwpvfuUIxZHDnG2xpIWlw+T5pUAQxxtP7HEsVLN EdPiJCbeKRdLlsbGODJcu06n7TouS1ZLmdpcSb9v/ymZxu9e5M7d25bf5BngilDXVhOK4kXh a7HSNUNHmBX2ik+eBKkIRwufic6KfxgTkvGU0LJZnB8e4EyI57cLGnHInBFBWogRjZV7InO5 kCg2+K7g98pPxfbO3neaKOEbsWfUiiKsCG+M3j72MpJZ0KY2FK3V5WaptJmJcYYMTYFOmx93 +myWA4V/YysMVXWjVxMpfUjgkXKLPH53rVrBqHINBVl9SOQpZbT8ozWzWiFXqwq+l/RnT+pz MiVDH9rJ08qP5YeOSacUwhlVtpQhSeck/YcW81E7ilA2/iTQZFtT5M+lpfr1BX9X9QSNLToy O/Gt74Znant62cnj6ZoX1F+PX36Z0J13PqbrwHzzeHaeufqG1TV2dLTZ9FDv3J3y+U2j/8St nluHpjeX/Di6b4C6Xu9MXklL2mUvzzmi+a7wynNe+XiobuPC9MYPb5JOHBxrV4T2PvK3xaYr aYNGlRBL6Q2qt1umRrEzAwAA X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 0C0D8C002C X-Rspam-User: X-Stat-Signature: i6cgogs5kpyzq8jn1jisdt1g96fk8qe4 X-Rspamd-Server: rspam01 X-HE-Tag: 1687780723-187741 X-HE-Meta: U2FsdGVkX1+cYiZevajHvPtvbdE+U7M/ED43vrRCn+0WDAl68zZmwAbBDzABqDHbytQlCtDf4N0z0fx77MZ/vDS5En8FRyGVnOFagXFNeW0hKGzesrQEdFs8MTX9ysnxCC3Uw0WfcBbFiUjT4gW9G3Mt0jkbsAsW0J9D8huG9nlGkRpjKWqMxLVvtEUbgXCzE/3OvySgcWdfjj0Sn2hhyqSUYDga1waEPUClxDH1ZOo39+4yB0twoo9UWNxDZYT4Wfhc7Izd9vc+OKkbHHv1mRV8XGuJNj6zJJ/IVF7mJuLFWmdPPOHWep4uYUZuXnMm3eQfee/2v6v05JsDP7k/6wYsRcKYUnP1pcML5HHur0qn49E4YdnjQGaoaYKHg7NzWsewwGIPNnpn8h33aqrRPX0e0upkfhutfL0z47IbM7ctQNt4oq2OrXM6SaU0aprPAo+5HjsPap0HN3kHoIGtpGhmrQmLrngicW28ZmpbhncllQjM/6MFqtnv4xTcqeZClKW+F95pqrF/RNOU3h8QNMNkgglDg+X1a/GODsB0UYGQ/l3rTIdK2H1UunDim7XJAZCwe3ZcSU/S0W331BCWJQk7oOr1Lurq9RfuU4fYDjff/nGHYHDsLSdtSRcqGhIfNnsbA4spr/XzvJrUbZGMQgS5eZlmwkF0sCoQ8IEU60u4JfcfBempD72/N6h38bJcm2nvqvge6t1Euoph8nChma43Vgts469+Mi3DCJi73HcCRj3riZc+Fsm/6/jRawXqlGyey0e+Zt1uFaIRPMHV31RUoq3Gq+QXvRngOCKoS6WSguOjJ2wn+0GX9oGDW8rlWSP9iX0p3wrm2ActAj9FzGFgEsSdt67m45djgIRwc2qmozXg4Qx6Zcn/M/I271bgWxIQUEYitjwughQXhREXcqGFbQdCyTKvC8nUC+xUd46NJVqAQ02IS8QBTNtkkfEJ8a3Ad4eL116PEVak248 ftLCY+rw rZSXbDPQgSFZruD4FpXEZhOkWUeROjm48NlxDCmz1DhREb6F22LrEt7TghVhZLLeipPq2M4yj17xgzpGp+V537Ey7emQr2JBU0MmufjC8BLBqNvw= 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);