Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp393658lqo; Wed, 8 May 2024 03:08:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVV1snYkt30pFaq+uu6EwuX5N9E1fa/PCjeAzaIeE9DpyAgvoXV8FgSShZJadL08wYIJdPjLyj8tpMUHE1TS5sEFDBeKf7a7JN+r8nqeQ== X-Google-Smtp-Source: AGHT+IE7HNvzvueP0QYS2VCyG600jbRu22xHG77rkwbNaZ84NDH4AWu5YhF+6E7L6Ux5KYrUZk7/ X-Received: by 2002:a50:9982:0:b0:572:7319:ab83 with SMTP id 4fb4d7f45d1cf-5731d9cceabmr1604253a12.6.1715162892354; Wed, 08 May 2024 03:08:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715162892; cv=pass; d=google.com; s=arc-20160816; b=PRzf5Ifl9taCohQRHPmMsLFaocKgoeiAKm5hxaIZdYOm9f24hQ1CE088YPqsECva77 d2HpD+laGkTb1T52iaLYWlEXQ3MUI4an7nqwQtqOjS9M7SvcL3v2+EOPM/RoLE7n8TXQ 4Y5w1yg+04M+g+++NkFCdY7Hb8LYgVXjL8/NO1BxvaEm2aquSiRZl+yxa4uz6lxH5Hd3 BmXDF8X9QVzM3jqU72b79Hz+XVyfjfImkhWmQX6cMvOkueCj1iy+H1ORyobwI/xaS0IZ tPUx6hf2u5REbO1xdU79Jy5XNzuVcG3YvTF+7b6AWVTJ/219WWRxqA3Tkv/nsw2PsIA8 7bNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=/KT++rAsN5y0nbFpM/QaU9svrtWClpotKzEm9ELMbD8=; fh=H2KRUF8uSM4+6+w6W9vKW2QB11XTfop4gd9hLuyjokE=; b=cGBxLJcmnwtLp+8rdsT+xJlgbIKJFie4uzaxwK8gfy5Yjtuvogs0upngZozVmsfbMS e0/hMHCrfVkX4m6HaxH7A6gCD9aXZELzTKQr+wwn+gzu9p1fuuTs+NBsHX2vCxBVJytt zYWKvfXEXUwd9jXF9AF62XkDo/D/eeIQb00dLqKij9DO60KnQTW46iUQ82eDx2UpwzvR PBxjiZlYoOj4BU1oQB0wF1Jw5nopqR9ZS6YhOT2VJUU03O+riKFmE6lUQBlLPljmz3zf ROnuzJ7frFmWFCKUPUbKgPIpl61gYCJMTOxFBGG/kcj85H9LrPK8ZgnMeTrriNeD83ka Cexw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-ext4+bounces-2384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2384-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p4-20020aa7d304000000b00572a13e7175si6830194edq.493.2024.05.08.03.08.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 03:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-ext4+bounces-2384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2384-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E6E9D1F21F87 for ; Wed, 8 May 2024 10:08:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F6E885921; Wed, 8 May 2024 10:03:08 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4EFF97D41C; Wed, 8 May 2024 10:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715162586; cv=none; b=Uevpuz7SHGJyJWVILHwWSv1g9dervyNOsMG60xPOevIh6O6JNH4KOdsS86GvQd8xt7i2Dq4QyymtqZ9coz6hX1HsDyweM6U5pc5X0WQZFUn8b6mP7CZT5tY6x5joNfd1a355jMNWaACgcR/cH61y+7dYdyiZG9Ib70T/ftyCvWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715162586; c=relaxed/simple; bh=dvBMB/3tVBl91UmE/Oqq9GwFm49AFiuEmYF2r5QUheY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=IxAWWqfCI8lDJVbFbzBX8pgChfewEtZVynkssawvQOVW3LS8nlXjrcXjv3LtWFa5NgyGm68MzqrhewOwnCrQFKQmcdaePV2I1ygYo8Q2TzXBjvMO/3fW7KdY99WcX7IrJpLMbedkFt2PG4Ip4AfTdRzqgLef0+bINzUgQrzZmdY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d85ff70000001748-95-663b4a39c48b 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, 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 v14 08/28] dept: Distinguish each work from another Date: Wed, 8 May 2024 18:47:05 +0900 Message-Id: <20240508094726.35754-9-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240508094726.35754-1-byungchul@sk.com> References: <20240508094726.35754-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSeUiTcRjH+/3e09XidRa9GVQsKjJSi46ngyiiersgkCIMqpWvOZpTZmoK gbW5zFLs0NUS8WIburS2EjusZTmPlVmZRzgvIpM8QtvIlGxa/fPw4ft8+PL88bCE7C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e: List-Unsubscribe: Workqueue already provides concurrency control. By that, any wait in a work doesn't prevents events in other works with the control enabled. Thus, each work would better be considered a different context. So let Dept assign a different context id to each work. Signed-off-by: Byungchul Park --- include/linux/dept.h | 2 ++ kernel/dependency/dept.c | 10 ++++++++++ kernel/workqueue.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/include/linux/dept.h b/include/linux/dept.h index 4e359f76ac3c..319a5b43df89 100644 --- a/include/linux/dept.h +++ b/include/linux/dept.h @@ -509,6 +509,7 @@ extern void dept_ecxt_exit(struct dept_map *m, unsigned long e_f, unsigned long extern void dept_sched_enter(void); extern void dept_sched_exit(void); extern void dept_kernel_enter(void); +extern void dept_work_enter(void); static inline void dept_ecxt_enter_nokeep(struct dept_map *m) { @@ -559,6 +560,7 @@ struct dept_task { }; #define dept_sched_enter() do { } while (0) #define dept_sched_exit() do { } while (0) #define dept_kernel_enter() do { } while (0) +#define dept_work_enter() do { } while (0) #define dept_ecxt_enter_nokeep(m) do { } while (0) #define dept_key_init(k) do { (void)(k); } while (0) #define dept_key_destroy(k) do { (void)(k); } while (0) diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c index 9aba9eb22760..a8e693fd590f 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1933,6 +1933,16 @@ void noinstr dept_hardirqs_off(void) dept_task()->hardirqs_enabled = false; } +/* + * Assign a different context id to each work. + */ +void dept_work_enter(void) +{ + struct dept_task *dt = dept_task(); + + dt->cxt_id[DEPT_CXT_PROCESS] += 1UL << DEPT_CXTS_NR; +} + void noinstr dept_kernel_enter(void) { struct dept_task *dt = dept_task(); diff --git a/kernel/workqueue.c b/kernel/workqueue.c index d2dbe099286b..e7b3818a26eb 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "workqueue_internal.h" @@ -3184,6 +3185,8 @@ __acquires(&pool->lock) lockdep_copy_map(&lockdep_map, &work->lockdep_map); #endif + dept_work_enter(); + /* ensure we're on the correct CPU */ WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) && raw_smp_processor_id() != pool->cpu); -- 2.17.1