Skip to contentSkip to conversation

replacement for "introduce pnfs private workqueue"

PATCH In review Jim Rees 6 participants 26 messages Sep 20, 2011 – Sep 22, 2011

Subsystems (2)
lore
Share & tools
lore

Jim Rees

author
#0 lore raw

cover replacement for "introduce pnfs private workqueue"

The first patch is a bug fix that has already been sent upstream. The next two patches should replace the following in your tree:

0359f0e pNFS: introduce pnfs private workqueue
d9b5876 SQUASHME: pnfs: simplify and clean up pnfsiod workqueue ef9e1a70 SQUASHME: pnfs: do pnfsiod_start before registering layout drivers

This will re-order the patches so that the bug fix is first, followed by the workqueue patches.

These are also available on the for-benny branch of my git repo.

Benny Halevy (1):
SQUASHME: pnfs: simplify and clean up pnfsiod workqueue

Peng Tao (2):
pnfsblock: add missing rpc_put_mount and path_put
pnfs: introduce pnfs private workqueue

 fs/nfs/blocklayout/blocklayout.c |   21 +++++++++++---
 fs/nfs/objlayout/objio_osd.c     |   10 ++++++-
 fs/nfs/objlayout/objlayout.c     |    4 +-
 fs/nfs/pnfs.c                    |   54 +++++++++++++++++++++++++++++++++++++-
 fs/nfs/pnfs.h                    |    4 +++
 5 files changed, 84 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.4.1
author
#1 lore raw

PATCH 1/3 pnfsblock: add missing rpc_put_mount and path_put

From: Peng Tao <[email protected]>

---
 fs/nfs/blocklayout/blocklayout.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/blocklayout.c +6 -2
index dc23833..dee6cae 100644
@@ -993,17 +993,20 @@ static int __init nfs4blocklayout_init(void)
 			      mnt,
 			      NFS_PIPE_DIRNAME, 0, &path);
 	if (ret)
-		goto out_remove;
+		goto out_putrpc;
 
 	bl_device_pipe = rpc_mkpipe(path.dentry, "blocklayout", NULL,
 				    &bl_upcall_ops, 0);
+	path_put(&path);
 	if (IS_ERR(bl_device_pipe)) {
 		ret = PTR_ERR(bl_device_pipe);
-		goto out_remove;
+		goto out_putrpc;
 	}
 out:
 	return ret;
 
+out_putrpc:
+	rpc_put_mount();
 out_remove:
 	pnfs_unregister_layoutdriver(&blocklayout_type);
 	return ret;
@@ -1016,6 +1019,7 @@ static void __exit nfs4blocklayout_exit(void)
 
 	pnfs_unregister_layoutdriver(&blocklayout_type);
 	rpc_unlink(bl_device_pipe);
+	rpc_put_mount();
 }
 
 MODULE_ALIAS("nfs-layouttype4-3");
Signature · 1 line
1.7.4.1
author
#2 lore raw

PATCH 2/3 pnfs: introduce pnfs private workqueue

In reply to Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a good place as the code is executed in IO path. So add a pnfs private workqueue to handle them.

Also change block and object layout code to make use of this private workqueue.

[pnfs: do pnfsiod_start before registering layout drivers]
---
 fs/nfs/blocklayout/blocklayout.c |   13 +++++++--
 fs/nfs/objlayout/objio_osd.c     |   10 ++++++-
 fs/nfs/objlayout/objlayout.c     |    4 +-
 fs/nfs/pnfs.c                    |   52 +++++++++++++++++++++++++++++++++++++-
 fs/nfs/pnfs.h                    |    4 +++
 5 files changed, 76 insertions(+), 7 deletions(-)
fs/nfs/blocklayout/blocklayout.c +10 -3
index dee6cae..0356016 100644
@@ -228,7 +228,7 @@ bl_end_par_io_read(void *data)
 	struct nfs_read_data *rdata = data;
 
 	INIT_WORK(&rdata->task.u.tk_work, bl_read_cleanup);
-	schedule_work(&rdata->task.u.tk_work);
+	pnfsiod_queue_work(&rdata->task.u.tk_work);
 }
 
 /* We don't want normal .rpc_call_done callback used, so we replace it
@@ -418,7 +418,7 @@ static void bl_end_par_io_write(void *data)
 	wdata->task.tk_status = 0;
 	wdata->verf.committed = NFS_FILE_SYNC;
 	INIT_WORK(&wdata->task.u.tk_work, bl_write_cleanup);
-	schedule_work(&wdata->task.u.tk_work);
+	pnfsiod_queue_work(&wdata->task.u.tk_work);
 }
 
 /* FIXME STUB - mark intersection of layout and page as bad, so is not
@@ -977,10 +977,14 @@ static int __init nfs4blocklayout_init(void)
 
 	dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__);
 
-	ret = pnfs_register_layoutdriver(&blocklayout_type);
+	ret = pnfsiod_start();
 	if (ret)
 		goto out;
 
+	ret = pnfs_register_layoutdriver(&blocklayout_type);
+	if (ret)
+		goto out_stop;
+
 	init_waitqueue_head(&bl_wq);
 
 	mnt = rpc_get_mount();
@@ -1009,6 +1013,8 @@ out_putrpc:
 	rpc_put_mount();
 out_remove:
 	pnfs_unregister_layoutdriver(&blocklayout_type);
+out_stop:
+	pnfsiod_stop();
 	return ret;
 }
 
@@ -1018,6 +1024,7 @@ static void __exit nfs4blocklayout_exit(void)
 	       __func__);
 
 	pnfs_unregister_layoutdriver(&blocklayout_type);
+	pnfsiod_stop();
 	rpc_unlink(bl_device_pipe);
 	rpc_put_mount();
 }
fs/nfs/objlayout/objio_osd.c +9 -1
index d0cda12..7e8f0cc 100644
@@ -1041,7 +1041,14 @@ MODULE_LICENSE("GPL");
 static int __init
 objlayout_init(void)
 {
-	int ret = pnfs_register_layoutdriver(&objlayout_type);
+	int ret;
+
+	ret = pnfsiod_start();
+	if (!ret) {
+		ret = pnfs_register_layoutdriver(&objlayout_type);
+		if (ret)
+			pnfsiod_stop();
+	}
 
 	if (ret)
 		printk(KERN_INFO
@@ -1057,6 +1064,7 @@ static void __exit
 objlayout_exit(void)
 {
 	pnfs_unregister_layoutdriver(&objlayout_type);
+	pnfsiod_stop();
 	printk(KERN_INFO "%s: Unregistered OSD pNFS Layout Driver\n",
 	       __func__);
 }
fs/nfs/objlayout/objlayout.c +2 -2
index 1d06f8e..f7c6c21 100644
@@ -305,7 +305,7 @@ objlayout_read_done(struct objlayout_io_state *state, ssize_t status, bool sync)
 		pnfs_ld_read_done(rdata);
 	else {
 		INIT_WORK(&rdata->task.u.tk_work, _rpc_read_complete);
-		schedule_work(&rdata->task.u.tk_work);
+		pnfsiod_queue_work(&rdata->task.u.tk_work);
 	}
 }
 
@@ -396,7 +396,7 @@ objlayout_write_done(struct objlayout_io_state *state, ssize_t status,
 		pnfs_ld_write_done(wdata);
 	else {
 		INIT_WORK(&wdata->task.u.tk_work, _rpc_write_complete);
-		schedule_work(&wdata->task.u.tk_work);
+		pnfsiod_queue_work(&wdata->task.u.tk_work);
 	}
 }
 
fs/nfs/pnfs.c +51 -1

67 lines not on this page · raw message

fs/nfs/pnfs.h +4 -0
index 01cbfd5..bc1eed5 100644
@@ -165,6 +165,10 @@ extern int nfs4_proc_layoutget(struct nfs4_layoutget *lgp);
 extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp);
 
 /* pnfs.c */
+int pnfsiod_start(void);
+void pnfsiod_stop(void);
+void pnfsiod_queue_work(struct work_struct* work);
+
 void get_layout_hdr(struct pnfs_layout_hdr *lo);
 void put_lseg(struct pnfs_layout_segment *lseg);
 
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 9 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a good place as the code is executed in IO path. So add a pnfs private workqueue to handle them.

Also change block and object layout code to make use of this private workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

Trond

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
author
#4 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 9 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a good place as the code is executed in IO path. So add a pnfs private workqueue to handle them.

Also change block and object layout code to make use of this private workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

I thought you were the one who asked for this, here:
http://www.spinics.net/lists/linux-nfs/msg22771.html

But looking back on it now, the IO path has changed and I can't tell if the argument still holds.

#5 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 18 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 6 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a good place as the code is executed in IO path. So add a pnfs private workqueue to handle them.

Quoted 8 lines
Quoted 3 lines

Also change block and object layout code to make use of this private workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If any function allocates memory in system_wq and causes dirty writeback in nfs path, the io_done function can never be called because it is after the original function in the system_wq. And you said that the rpciod/nfsiod is not the ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

Quoted 6 lines

I thought you were the one who asked for this, here:
http://www.spinics.net/lists/linux-nfs/msg22771.html

But looking back on it now, the IO path has changed and I can't tell if the argument still holds.

I believe it still holds. The recollapse path still involves memory allocation.

Cheers,
Tao

#6 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 1 line

path, the io_done function can never be called because it is after the

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Trond

#7 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 53 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 8 lines
Quoted 1 line

path, the io_done function can never be called because it is after the

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is more than just an optimization.

Quoted 4 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can be invoked during memory reclaim. And I agree that a normal kthread can solve it.

However, the blocklayout write end_io function still needs a context where it can allocate memory to convert extent state (for every IO that touches new extents). If you look into the patch, we are not just using the pnfs private workqueue to handle pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.
If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e., by just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout has a private workqueue, it no longer needs the normal kthread for read/write_done error handling, which leaves the kthread only specific to object layout (if it doesn't need a workqueue like blocklayout does).

So I think a generic pnfs workqueue is better because it simplifies things and solve both problems.

Best,
Tao

Quoted 2 lines

Trond

#8 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 64 lines · On 2011-09-21 08:16, [email protected] wrote:
Quoted 53 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 8 lines
Quoted 1 line

path, the io_done function can never be called because it is after the

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is more than just an optimization.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can be invoked during memory reclaim. And I agree that a normal kthread can solve it.

However, the blocklayout write end_io function still needs a context where it can allocate memory to convert extent state (for every IO that touches new extents). If you look into the patch, we are not just using the pnfs private workqueue to handle pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.

Can this memory be preallocated before the I/O for the common case?

Benny

Quoted 10 lines

If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e., by just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout has a private workqueue, it no longer needs the normal kthread for read/write_done error handling, which leaves the kthread only specific to object layout (if it doesn't need a workqueue like blocklayout does).

So I think a generic pnfs workqueue is better because it simplifies things and solve both problems.

Best,
Tao

Quoted 2 lines

Trond

#9 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Hi, Benny,

Quoted 82 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Benny Halevy
Sent: Wednesday, September 21, 2011 3:05 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 54 lines · On 2011-09-21 08:16, [email protected] wrote:
Quoted 54 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 1 line

path, the io_done function can never be called because it is after the

Quoted 8 lines
Quoted 7 lines

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is

more than just an optimization.

Quoted 6 lines
Quoted 5 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with

WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can be invoked during memory reclaim. And I agree that a normal kthread can solve it.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

However, the blocklayout write end_io function still needs a context where it can

allocate memory to convert extent state (for every IO that touches new extents). If you look into the patch, we are not just using the pnfs private workqueue to handle pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.

Can this memory be preallocated before the I/O for the common case?

It is possible to preallocate memory for the common case. But it doesn't remove the need for workqueue. Without workqueue, we will need to put a bunch of extent manipulation code into bio->end_io, which is executed in bottom half and we always need minimize its execution.

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

not sure if it worth the complexity though...

Cheers,
Tao

Quoted 23 lines

Benny

Quoted 1 line

If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e., by

just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout has a private workqueue, it no longer needs the normal kthread for read/write_done error handling, which leaves the kthread only specific to object layout (if it doesn't need a workqueue like blocklayout does).

Quoted 2 lines

So I think a generic pnfs workqueue is better because it simplifies things and solve

both problems.

Quoted 7 lines

Best,
Tao

Quoted 2 lines

Trond

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 11 lines · On 09/21/2011 01:23 PM, [email protected] wrote:

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

not sure if it worth the complexity though...

Cheers,
Tao

Please forgive my ignorance but what is the big difference between a kthread and a workqueue? I thought a workqueue is just a kthread and some memory structures (list).

I agree with "keep things simple"

But what do I know ;-)

Thanks
Boaz

#11 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

SGksIEJvYXosDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IGxpbnV4LW5m cy1vd25lckB2Z2VyLmtlcm5lbC5vcmcgW21haWx0bzpsaW51eC1uZnMtb3duZXJAdmdlci5rZXJu ZWwub3JnXQ0KPiBPbiBCZWhhbGYgT2YgQm9heiBIYXJyb3NoDQo+IFNlbnQ6IFdlZG5lc2RheSwg U2VwdGVtYmVyIDIxLCAyMDExIDY6MzggUE0NCj4gVG86IFBlbmcsIFRhbw0KPiBDYzogYmhhbGV2 eUB0b25pYW4uY29tOyBUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbTsgbGludXgtbmZzQHZnZXIu a2VybmVsLm9yZzsNCj4gaG9uZXlAY2l0aS51bWljaC5lZHU7IHJlZXNAdW1pY2guZWR1DQo+IFN1 YmplY3Q6IFJlOiBbUEFUQ0ggMi8zXSBwbmZzOiBpbnRyb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m9uZCBleHBsYWluZWQsIHNpbmNlIHRoZSBlcnJvciBj YXNlIHNob3VsZCBiZSByYXJlLCBpdCBpcyBub3QgbmVjZXNzYXJ5IHRvIGtlZXAgYSB0aHJlYWQg dXAgYW5kIHdhaXRpbmcgZm9yIGl0IGFsbCB0aGUgdGltZS4NCkFuZCBieSB3b3JrcXVldWUsIEkg dGhpbmsgeW91IGtub3cgZXhhY3RseSB3aGF0IGl0IGlzIDopDQoNCkNoZWVycywNClRhbw0KPiAN Cj4gSSBhZ3JlZSB3aXRoICJrZWVwIHRoaW5ncyBzaW1wbGUiDQo+IA0KPiBCdXQgd2hhdCBkbyBJ IGtub3cgOy0pDQo+IA0KPiBUaGFua3MNCj4gQm9heg0KPiAtLQ0KPiBUbyB1bnN1YnNjcmliZSBm cm9tIHRoaXMgbGlzdDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtbmZzIiBpbg0K PiB0aGUgYm9keSBvZiBhIG1lc3NhZ2UgdG8gbWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZw0KPiBN b3JlIG1ham9yZG9tbyBpbmZvIGF0ICBodHRwOi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1p bmZvLmh0bWwNCg0KTu+/ve+/ve+/ve+/ve+/vXLvv73vv71577+977+977+9Yu+/vVjvv73vv73H p3bvv71e77+9Kd66ey5u77+9K++/ve+/ve+/ve+/vXvvv73vv73vv70i77+977+9Xm7vv71y77+9 77+977+9eu+/vRrvv73vv71o77+977+977+977+9Ju+/ve+/vR7vv71H77+977+977+9aO+/vQMo 77+96ZqO77+93aJqIu+/ve+/vRrvv70bbe+/ve+/ve+/ve+/ve+/vXrvv73elu+/ve+/ve+/vWbv v73vv73vv71o77+977+977+9fu+/vW3vv70=

#12 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

In reply to [email protected]
Quoted 91 lines · On 2011-09-21 13:23, [email protected] wrote:

Hi, Benny,

Quoted 82 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Benny Halevy
Sent: Wednesday, September 21, 2011 3:05 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 54 lines · On 2011-09-21 08:16, [email protected] wrote:
Quoted 54 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 1 line

path, the io_done function can never be called because it is after the

Quoted 8 lines
Quoted 7 lines

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is

more than just an optimization.

Quoted 6 lines
Quoted 5 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with

WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can be invoked during memory reclaim. And I agree that a normal kthread can solve it.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

However, the blocklayout write end_io function still needs a context where it can

allocate memory to convert extent state (for every IO that touches new extents). If you look into the patch, we are not just using the pnfs private workqueue to handle pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.

Can this memory be preallocated before the I/O for the common case?

Quoted 8 lines

It is possible to preallocate memory for the common case. But it doesn't remove the need for workqueue. Without workqueue, we will need to put a bunch of extent manipulation code into bio->end_io, which is executed in bottom half and we always need minimize its execution.

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

not sure if it worth the complexity though...

We do want to avoid memory allocation on the completion path to ensure completion under memory pressure and graceful handling of low memory conditions so I think this approach is worth while.

Having a lightweight handler on the bottom half done path is ok too.

Doing the heavy lifting for the (assumingly rare) error case in a workqueue/ kthread makes a sense, just it mustn't block. Could you use the nfs state manager for that?

Benny

Quoted 23 lines

Cheers,
Tao

Quoted 19 lines

Benny

Quoted 1 line

If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e., by

just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout has a private workqueue, it no longer needs the normal kthread for read/write_done error handling, which leaves the kthread only specific to object layout (if it doesn't need a workqueue like blocklayout does).

Quoted 2 lines

So I think a generic pnfs workqueue is better because it simplifies things and solve

both problems.

Quoted 7 lines

Best,
Tao

Quoted 2 lines

Trond

#13 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 122 lines

-----Original Message-----
From: Benny Halevy [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 6:57 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 4 lines · On 2011-09-21 13:23, [email protected] wrote:

Hi, Benny,

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:[email protected]]

Quoted 70 lines
Quoted 70 lines

On Behalf Of Benny Halevy
Sent: Wednesday, September 21, 2011 3:05 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 62 lines · On 2011-09-21 08:16, [email protected] wrote:
Quoted 53 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 8 lines
Quoted 1 line

path, the io_done function can never be called because it is after the

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is

Quoted 8 lines
Quoted 8 lines

more than just an optimization.

Quoted 6 lines
Quoted 5 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with

WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can

be

Quoted 3 lines
Quoted 3 lines

invoked during memory reclaim. And I agree that a normal kthread can solve it.

Quoted 2 lines

However, the blocklayout write end_io function still needs a context where it

can

Quoted 1 line
Quoted 1 line

allocate memory to convert extent state (for every IO that touches new extents).

If

Quoted 1 line
Quoted 1 line

you look into the patch, we are not just using the pnfs private workqueue to

handle

Quoted 5 lines
Quoted 4 lines

pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.

Can this memory be preallocated before the I/O for the common case?

It is possible to preallocate memory for the common case. But it doesn't remove

the need for workqueue. Without workqueue, we will need to put a bunch of extent manipulation code into bio->end_io, which is executed in bottom half and we always need minimize its execution.

Quoted 7 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

not sure if it worth the complexity though...

We do want to avoid memory allocation on the completion path to ensure completion under memory pressure and graceful handling of low memory conditions
so I think this approach is worth while.

Quoted 5 lines

Having a lightweight handler on the bottom half done path is ok too.

Doing the heavy lifting for the (assumingly rare) error case in a workqueue/ kthread makes a sense, just it mustn't block. Could you use the nfs state manager for that?

I don't quite understand. How do you use nfs state manager to do other tasks?

Thanks,
Tao

Quoted 31 lines

Benny

Quoted 8 lines

Cheers,
Tao

Quoted 4 lines

Benny

Quoted 1 line

If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e.,

by

Quoted 2 lines
Quoted 2 lines

just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout

has a

Quoted 1 line
Quoted 1 line

private workqueue, it no longer needs the normal kthread for read/write_done

error

Quoted 1 line
Quoted 1 line

handling, which leaves the kthread only specific to object layout (if it doesn't

need a

Quoted 3 lines
Quoted 3 lines

workqueue like blocklayout does).

Quoted 2 lines

So I think a generic pnfs workqueue is better because it simplifies things and

solve

Quoted 8 lines
Quoted 8 lines

both problems.

Quoted 7 lines

Best,
Tao

Quoted 2 lines

Trond

#14 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 122 lines · On 2011-09-21 14:10, [email protected] wrote:
Quoted 122 lines

-----Original Message-----
From: Benny Halevy [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 6:57 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 4 lines · On 2011-09-21 13:23, [email protected] wrote:

Hi, Benny,

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:[email protected]]

Quoted 70 lines
Quoted 70 lines

On Behalf Of Benny Halevy
Sent: Wednesday, September 21, 2011 3:05 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 62 lines · On 2011-09-21 08:16, [email protected] wrote:
Quoted 53 lines

-----Original Message-----
From: Myklebust, Trond [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:20 PM
To: Peng, Tao
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 5 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 10:44 PM
To: Myklebust, Trond
Cc: [email protected]; [email protected];

[email protected];

Quoted 19 lines

[email protected]
Subject: RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 15 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jim Rees
Sent: Wednesday, September 21, 2011 8:29 AM
To: Trond Myklebust
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good

Quoted 2 lines

place as

Quoted 1 line
Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines
Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

workqueue.

Wait, what????

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

The current code uses the system_wq to handle io_done functions. If

any

Quoted 1 line

function allocates memory in system_wq and causes dirty writeback in

nfs

Quoted 8 lines
Quoted 1 line

path, the io_done function can never be called because it is after the

original

Quoted 1 line

function in the system_wq. And you said that the rpciod/nfsiod is not

the

Quoted 2 lines

ideal place because of memory allocation. So I suggested pnfs private workqueue and Benny agreed on it.

You appear to be optimizing for a corner case. Why?

Current code uses system_wq for io_done and it can cause deadlock. So this is

Quoted 8 lines
Quoted 8 lines

more than just an optimization.

Quoted 6 lines
Quoted 5 lines

IOW: why do we need a whole new workqueue for something which is supposed to be extremely rare? Why can't we just use standard keventd or allocate a perfectly normal thread (e.g. the state recovery thread)?

Unlike nfsiod and rpciod, keventd (aka, system_wq) is not created with

WQ_MEM_RECLAIM, indicating that it should not be used for IO path which can

be

Quoted 3 lines
Quoted 3 lines

invoked during memory reclaim. And I agree that a normal kthread can solve it.

Quoted 2 lines

However, the blocklayout write end_io function still needs a context where it

can

Quoted 1 line
Quoted 1 line

allocate memory to convert extent state (for every IO that touches new extents).

If

Quoted 1 line
Quoted 1 line

you look into the patch, we are not just using the pnfs private workqueue to

handle

Quoted 5 lines
Quoted 4 lines

pnfs_ld_read/write_done, but also calling mark_extents_written() inside the workqueue.

Can this memory be preallocated before the I/O for the common case?

It is possible to preallocate memory for the common case. But it doesn't remove

the need for workqueue. Without workqueue, we will need to put a bunch of extent manipulation code into bio->end_io, which is executed in bottom half and we always need minimize its execution.

Quoted 7 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

not sure if it worth the complexity though...

We do want to avoid memory allocation on the completion path to ensure completion under memory pressure and graceful handling of low memory conditions
so I think this approach is worth while.

Quoted 6 lines
Quoted 5 lines

Having a lightweight handler on the bottom half done path is ok too.

Doing the heavy lifting for the (assumingly rare) error case in a workqueue/ kthread makes a sense, just it mustn't block. Could you use the nfs state manager for that?

I don't quite understand. How do you use nfs state manager to do other tasks?

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up. It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Benny

Quoted 35 lines

Thanks,
Tao

Quoted 31 lines

Benny

Quoted 8 lines

Cheers,
Tao

Quoted 4 lines

Benny

Quoted 1 line

If we don't create a pnfs private workqueue for pnfs_ld_read/write_done (i.e.,

by

Quoted 2 lines
Quoted 2 lines

just creating a normal kthread in error case), we would still have to create a workqueue inside blocklayout driver to handle write end_io. And if blocklayout

has a

Quoted 1 line
Quoted 1 line

private workqueue, it no longer needs the normal kthread for read/write_done

error

Quoted 1 line
Quoted 1 line

handling, which leaves the kthread only specific to object layout (if it doesn't

need a

Quoted 3 lines
Quoted 3 lines

workqueue like blocklayout does).

Quoted 2 lines

So I think a generic pnfs workqueue is better because it simplifies things and

solve

Quoted 8 lines
Quoted 8 lines

both problems.

Quoted 7 lines

Best,
Tao

Quoted 2 lines

Trond

#15 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 6 lines · Benny Halevy
Quoted 5 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS I don't quite understand. How do you use nfs state manager to do other tasks?

Quoted 6 lines

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up. It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Benny

Good god, Is it not already too complicated?

The LD is out of the picture. You all seemed to agree that
the LD has reported an io_done on the nfsiod/rpciod, and in the error case Generic layer needs to do it's coalescing on some other thread. So your description above is not correct, the LD is out of the picture.

It all looks too complicated for me. A pnfs workqueue for both 2 and 3 above is very good. Specially since the workqueue also shares global pool threads, No? I like it that there is a preallocated thread for the error-case, think about it.

Thanks
Boaz

#16 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 12 lines · Boaz Harrosh
Quoted 11 lines · Benny Halevy
Quoted 5 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS I don't quite understand. How do you use nfs state manager to do other tasks?

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up. It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Quoted 9 lines
Quoted 1 line

Benny

Good god, Is it not already too complicated?

The LD is out of the picture. You all seemed to agree that
the LD has reported an io_done on the nfsiod/rpciod, and in the error case Generic layer needs to do it's coalescing on some other thread. So your description above is not correct, the LD is out of the picture.

True, if the ld cleanup on io_done is sufficient.

Quoted 4 lines

It all looks too complicated for me. A pnfs workqueue for both 2 and 3 above is very good. Specially since the workqueue also shares global pool threads, No? I like it that there is a preallocated thread for the error-case, think about it.

I'm fine too with using a workqueue for the error case. But I'd rather have the common case done path do only lightweight, wait free processing.

Benny

Quoted 7 lines

Thanks
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 30 lines · Benny Halevy
Quoted 12 lines · Boaz Harrosh
Quoted 11 lines · Benny Halevy
Quoted 5 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS I don't quite understand. How do you use nfs state manager to do other tasks?

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up. It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Quoted 9 lines
Quoted 1 line

Benny

Good god, Is it not already too complicated?

The LD is out of the picture. You all seemed to agree that
the LD has reported an io_done on the nfsiod/rpciod, and in the error case Generic layer needs to do it's coalescing on some other thread. So your description above is not correct, the LD is out of the picture.

True, if the ld cleanup on io_done is sufficient.

Quoted 4 lines

It all looks too complicated for me. A pnfs workqueue for both 2 and 3 above is very good. Specially since the workqueue also shares global pool threads, No? I like it that there is a preallocated thread for the error-case, think about it.

Quoted 6 lines

I'm fine too with using a workqueue for the error case. But I'd rather have the common case done path do only lightweight, wait free processing.

Benny

If by "common case done path do only lightweight" you mean "preallocate memory for extent state conversion". Then I absolutely agree. But as far as workqueue/kthread then nfsiod/rpciod-wq or pnfs-wq is exactly the same for the "common case". Unless I'm totally missing the point. What are you saying?

These are the options so far:

[Toe's option which he rather not]
1. preallocate memory for extent state conversion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

[My option which I think Toe agrees with]
1. preallocate memory for extent state conversion
2. use pnfs-wq to handle bl_write_cleanup
3. pnfs error case, just like Toe's patches as part of io_done on pnfs-wq

Any other options?
Boaz

#18 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 51 lines · Boaz Harrosh
Quoted 30 lines · Benny Halevy
Quoted 12 lines · Boaz Harrosh
Quoted 11 lines · Benny Halevy
Quoted 5 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS I don't quite understand. How do you use nfs state manager to do other tasks?

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up.  It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Quoted 9 lines
Quoted 1 line

Benny

Good god, Is it not already too complicated?

The LD is out of the picture. You all seemed to agree that
the LD has reported an io_done on the nfsiod/rpciod, and in the error case Generic layer needs to do it's coalescing on some other thread. So your description above is not correct, the LD is out of the picture.

True, if the ld cleanup on io_done is sufficient.

Quoted 4 lines

It all looks too complicated for me. A pnfs workqueue for both 2 and 3 above is very good. Specially since the workqueue also shares global pool threads, No? I like it that there is a preallocated thread for the error-case, think about it.

Quoted 6 lines

I'm fine too with using a workqueue for the error case. But I'd rather have the common case done path do only lightweight, wait free processing.

Benny

If by "common case done path do only lightweight" you mean "preallocate memory for extent state conversion". Then I absolutely agree. But as far as workqueue/kthread then nfsiod/rpciod-wq or pnfs-wq is exactly the same for the "common case". Unless I'm totally missing the point. What are you saying?

These are the options so far:

[Toe's option which he rather not]
1. preallocate memory for extent state conversion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

Quoted 5 lines

[My option which I think Toe agrees with]
1. preallocate memory for extent state conversion
2. use pnfs-wq to handle bl_write_cleanup
3. pnfs error case, just like Toe's patches as part of io_done on pnfs-wq

Yeah, I would vote for this one because of its simplicity. ;-)

Thanks,
Tao

Quoted 8 lines

Any other options?
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thanks,
-Bergwolf
#19 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 52 lines · Peng Tao
Quoted 51 lines · Boaz Harrosh
Quoted 30 lines · Benny Halevy
Quoted 12 lines · Boaz Harrosh
Quoted 11 lines · Benny Halevy
Quoted 5 lines

Unless we do following:
1. preallocate memory for extent state convertion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS I don't quite understand. How do you use nfs state manager to do other tasks?

You need to keep a list of things to do hanging off of the nfs client structure and set a bit in cl_state telling the state manager it has work to do and wake it up. It then needs to go over the list of, say nfs_inodes and call into the layout driver to handle the errors.

Quoted 9 lines
Quoted 1 line

Benny

Good god, Is it not already too complicated?

The LD is out of the picture. You all seemed to agree that
the LD has reported an io_done on the nfsiod/rpciod, and in the error case Generic layer needs to do it's coalescing on some other thread. So your description above is not correct, the LD is out of the picture.

True, if the ld cleanup on io_done is sufficient.

Quoted 4 lines

It all looks too complicated for me. A pnfs workqueue for both 2 and 3 above is very good. Specially since the workqueue also shares global pool threads, No? I like it that there is a preallocated thread for the error-case, think about it.

Quoted 6 lines

I'm fine too with using a workqueue for the error case. But I'd rather have the common case done path do only lightweight, wait free processing.

Benny

If by "common case done path do only lightweight" you mean "preallocate memory for extent state conversion". Then I absolutely agree. But as far as workqueue/kthread then nfsiod/rpciod-wq or pnfs-wq is exactly the same for the "common case". Unless I'm totally missing the point. What are you saying?

These are the options so far:

[Toe's option which he rather not]
1. preallocate memory for extent state conversion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

Quoted 6 lines
Quoted 5 lines

[My option which I think Toe agrees with]
1. preallocate memory for extent state conversion
2. use pnfs-wq to handle bl_write_cleanup
3. pnfs error case, just like Toe's patches as part of io_done on pnfs-wq

Yeah, I would vote for this one because of its simplicity. ;-)

Sigh... The problem is that it completely fails to address the problem.

What's the difference between having pNFS completions run on nfsiod or their own work queue? You'd be running i/o and allocations on the same queue in both cases.

Cheers
Trond

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#20 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

SGksIFRyb25kLA0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IGxpbnV4 LW5mcy1vd25lckB2Z2VyLmtlcm5lbC5vcmcgW21haWx0bzpsaW51eC1uZnMtb3duZXJAdmdlci5r ZXJuZWwub3JnXQ0KPiBPbiBCZWhhbGYgT2YgVHJvbmQgTXlrbGVidXN0DQo+IFNlbnQ6IFRodXJz ZGF5LCBTZXB0ZW1iZXIgMjIsIDIwMTEgMTI6MDQgQU0NCj4gVG86IFBlbmcgVGFvDQo+IENjOiBC b2F6IEhhcnJvc2g7IEJlbm55IEhhbGV2eTsgUGVuZywgVGFvOyBsaW51eC1uZnNAdmdlci5rZXJu ZWwub3JnOw0KPiBob25leUBjaXRpLnVtaWNoLmVkdTsgcmVlc0B1bWljaC5lZHUNCj4gU3ViamVj dDogUmU6IFtQQVRDSCAyLzNdIHBuZnM6IGludHJvZHVjZSBwbmZzIHByaXZhdGUgd29ya3F1ZXVl DQo+IA0KPiBPbiBXZWQsIDIwMTEtMDktMjEgYXQgMjM6NDUgKzA4MDAsIFBlbmcgVGFvIHdyb3Rl Og0KPiA+IE9uIFdlZCwgU2VwIDIxLCAyMDExIGF0IDk6NTYgUE0sIEJvYXogSGFycm9zaCA8Ymhh cnJvc2hAcGFuYXNhcy5jb20+IHdyb3RlOg0KPiA+ID4gT24gMDkvMjEvMjAxMSAwMjo1MCBQTSwg QmVubnkgSGFsZXZ5IHdyb3RlOg0KPiA+ID4+IE9uIDIwMTEtMDktMjEgMTQ6NDIsIEJvYXogSGFy cm9zaCB3cm90ZToNCj4gPiA+Pj4gT24gMDkvMjEvMjAxMSA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vv73Hp3bvv71e77+9Kd66ey5u77+9K++/ve+/ve+/ve+/vXvvv73vv73v v70i77+977+9Xm7vv71y77+977+977+9eu+/vRrvv73vv71o77+977+977+977+9Ju+/ve+/vR7v v71H77+977+977+9aO+/vQMo77+96ZqO77+93aJqIu+/ve+/vRrvv70bbe+/ve+/ve+/ve+/ve+/ vXrvv73elu+/ve+/ve+/vWbvv73vv73vv71o77+977+977+9fu+/vW3vv70=

#21 lore raw

Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

In reply to Trond Myklebust
Quoted 13 lines · Trond Myklebust
Quoted 13 lines
Quoted 13 lines

These are the options so far:

[Toe's option which he rather not]
1. preallocate memory for extent state conversion
2. use nfsiod/rpciod to handle bl_write_cleanup
3. for pnfs error case, create a kthread to recollapse and resend to MDS

[My option which I think Toe agrees with]
1. preallocate memory for extent state conversion
2. use pnfs-wq to handle bl_write_cleanup
3. pnfs error case, just like Toe's patches as part of io_done on pnfs-wq

Quoted 8 lines
Quoted 1 line

Yeah, I would vote for this one because of its simplicity. ;-)

Sigh... The problem is that it completely fails to address the problem.

What's the difference between having pNFS completions run on nfsiod or their own work queue? You'd be running i/o and allocations on the same queue in both cases.

I don't understand, did you mean "io_done" and "coalescing" (which does allocations), so IO cannot complete to clean up memory so allocations can proceed?

But I thought we don't do that with Toe's latest patches. because we no longer do coalescing on the io_done path. We only re-dirty the memory and let the normal nfsiod/rpciod do the coalescing.

So it is what you want pnfs-wq is only for io_done the regular coalescing/allocation is done in fsiod/rpciod. I though that was the all Idea no? (It was your idea actually)

Or I might completely missed the point. Please explain

Quoted 3 lines

Cheers
Trond

Thanks
Boaz

#22 lore raw

RE: [PATCH 2/3] pnfs: introduce pnfs private workqueue

In reply to Jim Rees
Quoted 7 lines

-----Original Message-----
From: Jim Rees [mailto:[email protected]]
Sent: Tuesday, September 20, 2011 8:29 PM
To: Myklebust, Trond
Cc: Benny Halevy; [email protected]; peter honeyman
Subject: Re: [PATCH 2/3] pnfs: introduce pnfs private workqueue

Quoted 6 lines

Trond Myklebust wrote:

Quoted 3 lines · Jim Rees

From: Peng Tao <[email protected]>

For layoutdriver io done functions, default workqueue is not a

good place

Quoted 2 lines

as

Quoted 1 line

the code is executed in IO path. So add a pnfs private workqueue

to

Quoted 4 lines

handle

Quoted 3 lines

them.

Also change block and object layout code to make use of this

private

Quoted 5 lines
Quoted 2 lines

workqueue.

Wait, what????

Quoted 7 lines

Why is the I/O path (i.e. the nfsiod queue) inappropriate for layoutdriver io_done functions?

I thought you were the one who asked for this, here:
http://www.spinics.net/lists/linux-nfs/msg22771.html

But looking back on it now, the IO path has changed and I can't tell

if the

Quoted 1 line

argument still holds.

You are reading too much into what I said. The fact that we shouldn't use the 'hot' nfs/rpciod workqueues doesn't imply that we need a completely separate pnfs workqueue. We already have plenty of generic workqueues and even context threads: why aren't they sufficient?

Trond

author
#23 lore raw

PATCH 3/3 SQUASHME: pnfs: simplify and clean up pnfsiod workqueue

In reply to Jim Rees

From: Benny Halevy <[email protected]>

---
 fs/nfs/pnfs.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)
fs/nfs/pnfs.c +18 -16
index 5ac7a78..e38b91a 100644
@@ -38,7 +38,7 @@
 /* Locking:
  *
  * pnfs_spinlock:
- *      protects pnfs_modules_tbl, pnfsiod_workqueue and pnfsiod_users.
+ *      protects pnfs_modules_tbl, pnfsiod_workqueue.
  */
 static DEFINE_SPINLOCK(pnfs_spinlock);
 
@@ -48,7 +48,7 @@ static DEFINE_SPINLOCK(pnfs_spinlock);
 static LIST_HEAD(pnfs_modules_tbl);
 
 static struct workqueue_struct *pnfsiod_workqueue;
-static int pnfsiod_users = 0;
+static atomic_t pnfsiod_users;
 
 /* Return the registered pnfs layout driver module matching given id */
 static struct pnfs_layoutdriver_type *
@@ -1488,18 +1488,22 @@ out:
 int pnfsiod_start(void)
 {
 	struct workqueue_struct *wq;
-	dprintk("RPC:       creating workqueue pnfsiod\n");
-	wq = alloc_workqueue("pnfsiod", WQ_MEM_RECLAIM, 0);
-	if (wq == NULL)
-		return -ENOMEM;
-	spin_lock(&pnfs_spinlock);
-	pnfsiod_users++;
+
+	dprintk("NFS:       creating workqueue pnfsiod\n");
+	atomic_inc(&pnfsiod_users);
 	if (pnfsiod_workqueue == NULL) {
-		pnfsiod_workqueue = wq;
-	} else {
-		destroy_workqueue(wq);
+		wq = alloc_workqueue("pnfsiod", WQ_MEM_RECLAIM, 0);
+		if (wq == NULL) {
+			pnfsiod_stop();
+			return -ENOMEM;
+		}
+		spin_lock(&pnfs_spinlock);
+		if (pnfsiod_workqueue == NULL)
+			pnfsiod_workqueue = wq;
+		else
+			destroy_workqueue(wq);
+		spin_unlock(&pnfs_spinlock);
 	}
-	spin_unlock(&pnfs_spinlock);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(pnfsiod_start);
@@ -1511,13 +1515,11 @@ void pnfsiod_stop(void)
 {
 	struct workqueue_struct *wq = NULL;
 
-	spin_lock(&pnfs_spinlock);
-	pnfsiod_users--;
-	if (pnfsiod_users == 0) {
+	if (atomic_dec_and_lock(&pnfsiod_users, &pnfs_spinlock)) {
 		wq = pnfsiod_workqueue;
 		pnfsiod_workqueue = NULL;
+		spin_unlock(&pnfs_spinlock);
 	}
-	spin_unlock(&pnfs_spinlock);
 	if (wq)
 		destroy_workqueue(wq);
 }
Signature · 1 line
1.7.4.1
#24 lore raw
In reply to Jim Rees

I've submitted this version to the public git tree (pnfs-all-3.1-rc4-2011-09-20)
and rebased it onto v3.1-rc6 plus Tronds bugfixes for -rc7. (pnfs-all-3.1-rc6-2011-09-20)

Benny

Quoted 26 lines · Jim Rees

The first patch is a bug fix that has already been sent upstream. The next two patches should replace the following in your tree:

0359f0e pNFS: introduce pnfs private workqueue
d9b5876 SQUASHME: pnfs: simplify and clean up pnfsiod workqueue ef9e1a70 SQUASHME: pnfs: do pnfsiod_start before registering layout drivers

This will re-order the patches so that the bug fix is first, followed by the workqueue patches.

These are also available on the for-benny branch of my git repo.

Benny Halevy (1):
SQUASHME: pnfs: simplify and clean up pnfsiod workqueue

Peng Tao (2):
pnfsblock: add missing rpc_put_mount and path_put
pnfs: introduce pnfs private workqueue

 fs/nfs/blocklayout/blocklayout.c |   21 +++++++++++---
 fs/nfs/objlayout/objio_osd.c     |   10 ++++++-
 fs/nfs/objlayout/objlayout.c     |    4 +-
 fs/nfs/pnfs.c                    |   54 +++++++++++++++++++++++++++++++++++++-
 fs/nfs/pnfs.h                    |    4 +++
 5 files changed, 84 insertions(+), 9 deletions(-)
author
#25 lore raw

Benny Halevy wrote:

I've submitted this version to the public git tree (pnfs-all-3.1-rc4-2011-09-20)
and rebased it onto v3.1-rc6 plus Tronds bugfixes for -rc7. (pnfs-all-3.1-rc6-2011-09-20)

Thanks!