From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C69F83E4C7F for ; Wed, 25 Mar 2026 15:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774454395; cv=none; b=DZmzRfnKtTB4gVvnh6Jm9u7luocKKlB8ctbH5P8hZ9++c4mBOY40QGjF3Ym+LZXs21+CoDftTETC5XSJy75uyZMeaWi5lSfHrt2RVSYdykFJqtLnusiUWVaytwaq1+DWjHvomluTQRaFbbwk8SmPAGGo7mLD6TmDHgMFww3dIv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774454395; c=relaxed/simple; bh=+0nYu3vCNrNhMzd9/cm+tOj/aB8NO24ErTKeKQYbAV0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uXbnSO/o1VwaFBZJRrYO31JfSirhf8XtLVuGuk88bie8hubmnilzzd/3Zsc7e/vieTu88QeH4f/wxH/G5nXPFq3csFwzKyoFoSMQDPm3HOcf+M3lMnFIjLV2o8CvmCISx/SdolDvNl1oEl0gRClsFicNLGl0HlwD9c0EV81njdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nzWM0u6Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nzWM0u6Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CAFEC19423; Wed, 25 Mar 2026 15:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774454395; bh=+0nYu3vCNrNhMzd9/cm+tOj/aB8NO24ErTKeKQYbAV0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nzWM0u6Qn1Ms4fqYrCExyYxHIfM6vh+F+i3D305lycMHoCKQn6flf2mB9tX4f0yf0 HDXCp6Qn0MlfR5lcr22WMhU8g009OnayD5giTXAChnzu0FmZa/FzGWmLdGWBL/oP+b 9bNXvXKVEzrJso+IcawYcSGjBzXjnncUNjHZUd6g8kvvwUalawwmFXR0/FSfVqhN4Z 5TcHvhGvaBtA+2pM8pdgJP8NvTvuG62bv34LWoketzyeLzuX0b+B8ZNPGl13T4UeuI QakjLYnapmg3qxQ35mZx2hDrLuKeP818tlYa1JC7mOE16Nmtd+Cd/hrAz+w4rd2Wo0 cBew4lBG36lxw== Date: Wed, 25 Mar 2026 05:59:54 -1000 From: Tejun Heo To: Matthew Brost Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 01/12] workqueue: Add interface to teach lockdep to warn on reclaim violations Message-ID: References: <20260316043255.226352-1-matthew.brost@intel.com> <20260316043255.226352-2-matthew.brost@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260316043255.226352-2-matthew.brost@intel.com> Sorry about the tardiness. Traveling during spring break. Getting more than I can catch up with each day. On Sun, Mar 15, 2026 at 09:32:44PM -0700, Matthew Brost wrote: > @@ -403,6 +403,7 @@ enum wq_flags { > */ > WQ_POWER_EFFICIENT = 1 << 7, > WQ_PERCPU = 1 << 8, /* bound to a specific cpu */ > + WQ_MEM_WARN_ON_RECLAIM = 1 << 9, /* teach lockdep to warn on reclaim */ Shouldn't this require WQ_MEM_RECLAIM? > +/** > + * workqueue_is_reclaim_annotated() - Test whether a workqueue is annotated for > + * reclaim safety > + * @wq: workqueue to test > + * > + * Returns true if @wq is flags have both %WQ_MEM_WARN_ON_RECLAIM and > + * %WQ_MEM_RECLAIM set. A workqueue marked with these flags indicates that it > + * participates in reclaim paths, and therefore must not perform memory > + * allocations that can recurse into reclaim (e.g., GFP_KERNEL is not allowed). > + * > + * Drivers can use this helper to enforce reclaim-safe behavior on workqueues > + * that are created or provided elsewhere in the code. > + * > + * Return: > + * true if the workqueue is reclaim-annotated, false otherwise. > + */ > +bool workqueue_is_reclaim_annotated(struct workqueue_struct *wq) > +{ > + return (wq->flags & WQ_MEM_WARN_ON_RECLAIM) && > + (wq->flags & WQ_MEM_RECLAIM); > +} > +EXPORT_SYMBOL_GPL(workqueue_is_reclaim_annotated); Why is this function necessary? It feels rather odd to use wq as the source of this information. Shouldn't that be an innate knowledge of the code that's using this? Thanks. -- tejun