From: Haakon Bugge <haakon.bugge@oracle.com>
To: Tejun Heo <tj@kernel.org>
Cc: OFED mailing list <linux-rdma@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
"rds-devel@oss.oracle.com" <rds-devel@oss.oracle.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Saeed Mahameed <saeedm@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Allison Henderson <allison.henderson@oracle.com>,
Manjunath Patil <manjunath.b.patil@oracle.com>,
Mark Zhang <markzhang@nvidia.com>,
Chuck Lever III <chuck.lever@oracle.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Yang Li <yang.lee@linux.alibaba.com>
Subject: Re: [PATCH v2 1/6] workqueue: Inherit NOIO and NOFS alloc flags
Date: Thu, 16 May 2024 15:27:15 +0000 [thread overview]
Message-ID: <D9786636-CACE-47E1-B4B6-26AB2C4244C3@oracle.com> (raw)
In-Reply-To: <ZkTos2YXowEFS2fR@slm.duckdns.org>
> On 15 May 2024, at 18:54, Tejun Heo <tj@kernel.org> wrote:
>
>> @@ -5583,6 +5600,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
>>
>> /* init wq */
>> wq->flags = flags;
>> + if (current->flags & PF_MEMALLOC_NOIO)
>> + wq->flags |= __WQ_NOIO;
>> + if (current->flags & PF_MEMALLOC_NOFS)
>> + wq->flags |= __WQ_NOFS;
>
> So, yeah, please don't do this. What if a NOIO callers wants to scheduler a
> work item so that it can user GFP_KERNEL allocations.
If one work function want to use GPF_KERNEL and another using GFP_NOIO, queued on the same workqueue, one could create two workqueues. Create one that is surrounded by memalloc_noio_{save,restore}, another surrounded by memalloc_flags_save() + current->flags &= ~PF_MEMALLOC_NOIO and memalloc_flags_restore().
If you imply a work functions that performs combinations of GFP_KERNEL and GFP_NOIO, that sounds a little bit peculiar to me, but if needed, it must be open-coded. But wouldn't that be the same case as a WQ created with WQ_MEM_RECLAIM?
> I don't mind a
> convenience feature to workqueue for this but this doesn't seem like the
> right way. Also, memalloc_noio_save() and memalloc_nofs_save() are
> convenience wrappers around memalloc_flags_save(), so it'd probably be
> better to deal with gfp flags directly rather than singling out these two
> flags.
Actually, based on https://lore.kernel.org/linux-fsdevel/ZZcgXI46AinlcBDP@casper.infradead.org, I am inclided to skip GFP_NOFS. Also because the use-case for this series does not need GFP_NOFS.
When you say "deal with gfp flags directly", do you imply during WQ creation or queuing work on one? I am OK with adding the other per-process memory allocation flags, but that doesn's solve your initial issue ("if a NOIO callers wants to scheduler a work item so that it can user GFP_KERNEL").
Thxs, Håkon
next prev parent reply other threads:[~2024-05-16 15:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 12:53 [PATCH v2 0/6] rds: rdma: Add ability to force GFP_NOIO Håkon Bugge
2024-05-15 12:53 ` [PATCH v2 1/6] workqueue: Inherit NOIO and NOFS alloc flags Håkon Bugge
2024-05-15 16:54 ` Tejun Heo
2024-05-16 15:27 ` Haakon Bugge [this message]
2024-05-16 16:29 ` Tejun Heo
2024-05-21 14:02 ` Haakon Bugge
2024-05-15 12:53 ` [PATCH v2 2/6] rds: Brute force GFP_NOIO Håkon Bugge
2024-05-15 12:53 ` [PATCH v2 3/6] RDMA/cma: " Håkon Bugge
2024-05-16 7:37 ` Zhu Yanjun
2024-05-16 15:49 ` Haakon Bugge
2024-05-16 19:07 ` Greg Sword
2024-05-17 9:28 ` Haakon Bugge
2024-05-26 9:27 ` Leon Romanovsky
2024-05-15 12:53 ` [PATCH v2 4/6] RDMA/cm: " Håkon Bugge
2024-05-15 12:53 ` [PATCH v2 5/6] RDMA/mlx5: " Håkon Bugge
2024-05-15 12:53 ` [PATCH v2 6/6] net/mlx5: " Håkon Bugge
2024-05-21 14:24 ` [PATCH v2 0/6] rds: rdma: Add ability to " Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D9786636-CACE-47E1-B4B6-26AB2C4244C3@oracle.com \
--to=haakon.bugge@oracle.com \
--cc=allison.henderson@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@ziepe.ca \
--cc=jiangshanlai@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=manjunath.b.patil@oracle.com \
--cc=markzhang@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.com \
--cc=saeedm@nvidia.com \
--cc=shiraz.saleem@intel.com \
--cc=tariqt@nvidia.com \
--cc=tj@kernel.org \
--cc=yang.lee@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox