linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq
       [not found] <CGME20250721062037epcas2p25fd6fcf66914a419ceefca3285ea09f3@epcas2p2.samsung.com>
@ 2025-07-21  6:40 ` hy50.seo
  2025-07-21  7:13   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: hy50.seo @ 2025-07-21  6:40 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
	cpgs, h10.kim, willdeacon, jaegeuk, chao, linux-fsdevel
  Cc: hy50.seo

if it write with the write back option with f2fs, kernel panic occurs.
Because the write back function uses bdi_wq and WQ_MEM_RECLAIM flag
is included and created.
However, this function calls f2fs_do_quota() of f2fs and finally tries to
perform quota_release_work.
the quota_release_work is performed in the events_unbound workqueue,
but the WQ_MEM_RECLAIM flag is not included.
Therefore, it causes warn_on_panic.

workqueue: WQ_MEM_RECLAIM writeback:wb_workfn is flushing !WQ_MEM_RECLAIM events_unbound:quota_release_workfn
Workqueue: writeback wb_workfn (flush-8:0)
Call trace:
 check_flush_dependency+0x160/0x16c
 __flush_work+0x168/0x738
 flush_delayed_work+0x58/0x70
 dquot_writeback_dquots+0x90/0x4bc
 f2fs_do_quota_sync+0x120/0x284
 f2fs_write_checkpoint+0x58c/0xe18
 f2fs_gc+0x3e8/0xd78
 f2fs_balance_fs+0x204/0x284
 f2fs_write_single_data_page+0x700/0xaf0
 f2fs_write_data_pages+0xe94/0x15bc
 do_writepages+0x170/0x3f8
 __writeback_single_inode+0xa0/0x8c4
 writeback_sb_inodes+0x2ac/0x708
 __writeback_inodes_wb+0xc0/0x118
 wb_writeback+0x1f4/0x664
 wb_workfn+0x62c/0x900
 process_one_work+0x3f8/0x968
 worker_thread+0x610/0x794
 kthread+0x1c4/0x1e4
 ret_from_fork+0x10/0x20

Signed-off-by: hy50.seo <hy50.seo@samsung.com>
---
 mm/backing-dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 783904d8c5ef..6ef5f23810fc 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -491,8 +491,7 @@ postcore_initcall(bdi_class_init);
 
 static int __init default_bdi_init(void)
 {
-	bdi_wq = alloc_workqueue("writeback", WQ_MEM_RECLAIM | WQ_UNBOUND |
-				 WQ_SYSFS, 0);
+	bdi_wq = alloc_workqueue("writeback", WQ_UNBOUND | WQ_SYSFS, 0);
 	if (!bdi_wq)
 		return -ENOMEM;
 	return 0;
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq
  2025-07-21  6:40 ` [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq hy50.seo
@ 2025-07-21  7:13   ` Christoph Hellwig
  2025-07-21  8:37     ` hoyoung seo
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2025-07-21  7:13 UTC (permalink / raw)
  To: hy50.seo
  Cc: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
	cpgs, h10.kim, willdeacon, jaegeuk, chao, linux-fsdevel

On Mon, Jul 21, 2025 at 03:40:24PM +0900, hy50.seo wrote:
> if it write with the write back option with f2fs, kernel panic occurs.
> Because the write back function uses bdi_wq and WQ_MEM_RECLAIM flag
> is included and created.
> However, this function calls f2fs_do_quota() of f2fs and finally tries to
> perform quota_release_work.
> the quota_release_work is performed in the events_unbound workqueue,
> but the WQ_MEM_RECLAIM flag is not included.

And what makes you assume the WQ_MEM_RECLAIM was added just for fun
and can simply be deleted?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq
  2025-07-21  7:13   ` Christoph Hellwig
@ 2025-07-21  8:37     ` hoyoung seo
  2025-07-22  5:59       ` 'Christoph Hellwig'
  0 siblings, 1 reply; 4+ messages in thread
From: hoyoung seo @ 2025-07-21  8:37 UTC (permalink / raw)
  To: 'Christoph Hellwig'
  Cc: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
	cpgs, h10.kim, willdeacon, jaegeuk, chao, linux-fsdevel



> -----Original Message-----
> From: Christoph Hellwig <hch@infradead.org>
> Sent: Monday, July 21, 2025 4:14 PM
> To: hy50.seo <hy50.seo@samsung.com>
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org;
> alim.akhtar@samsung.com; avri.altman@wdc.com; jejb@linux.ibm.com;
> martin.petersen@oracle.com; beanhuo@micron.com; bvanassche@acm.org;
> kwangwon.min@samsung.com; kwmad.kim@samsung.com; cpgs@samsung.com;
> h10.kim@samsung.com; willdeacon@google.com; jaegeuk@google.com;
> chao@kernel.org; linux-fsdevel@vger.kernel.org
> Subject: Re: [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq
> 
> On Mon, Jul 21, 2025 at 03:40:24PM +0900, hy50.seo wrote:
> > if it write with the write back option with f2fs, kernel panic occurs.
> > Because the write back function uses bdi_wq and WQ_MEM_RECLAIM flag is
> > included and created.
> > However, this function calls f2fs_do_quota() of f2fs and finally tries
> > to perform quota_release_work.
> > the quota_release_work is performed in the events_unbound workqueue,
> > but the WQ_MEM_RECLAIM flag is not included.
> 
> And what makes you assume the WQ_MEM_RECLAIM was added just for fun and
> can simply be deleted?

No way..
It's because i just don't know much about this part.
And WQ_MEM_RECLAIM flag is absolutely necessary.
Because it is necessary for stable write back operation when memory is
insufficient. 
is it right?
I'll find another way for fix bug.
Thanks for your reply.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq
  2025-07-21  8:37     ` hoyoung seo
@ 2025-07-22  5:59       ` 'Christoph Hellwig'
  0 siblings, 0 replies; 4+ messages in thread
From: 'Christoph Hellwig' @ 2025-07-22  5:59 UTC (permalink / raw)
  To: hoyoung seo
  Cc: 'Christoph Hellwig', linux-scsi, linux-kernel,
	alim.akhtar, avri.altman, jejb, martin.petersen, beanhuo,
	bvanassche, kwangwon.min, kwmad.kim, cpgs, h10.kim, willdeacon,
	jaegeuk, chao, linux-fsdevel

On Mon, Jul 21, 2025 at 05:37:03PM +0900, hoyoung seo wrote:
> No way..
> It's because i just don't know much about this part.
> And WQ_MEM_RECLAIM flag is absolutely necessary.

As a rule of thumb try to write an explanation why a change is safe.
That usually kicks of a process to think about the implications.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-22  5:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250721062037epcas2p25fd6fcf66914a419ceefca3285ea09f3@epcas2p2.samsung.com>
2025-07-21  6:40 ` [PATCH v1] writback: remove WQ_MEM_RECLAIM flag in bdi_wq hy50.seo
2025-07-21  7:13   ` Christoph Hellwig
2025-07-21  8:37     ` hoyoung seo
2025-07-22  5:59       ` 'Christoph Hellwig'

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).