mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drbd: remove BIOSET_NEED_RESCUER flag from drbd_{md_,}io_bio_set
@ 2017-08-29 22:16 NeilBrown
  0 siblings, 0 replies; only message in thread
From: NeilBrown @ 2017-08-29 22:16 UTC (permalink / raw)
  To: Philipp Reisner, Lars Ellenberg; +Cc: drbd-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]


Careful analysis shows that this flag is not needed.

The RESCUER flag is only needed when a make_request_fn might:
 - allocate a bio from the bioset
 - submit it with generic_make_request() or similar
 - allocate another bio from the bioset

The second allocation can block until the first bio is processed, so
a rescuer is needed to ensure the first bio does get processed.  With
a rescuer it will only get processed when the make_request_fn completes.

In drbd, allocations from drbd_io_bio_set happen from drbd_new_req()
or w_restart_disk_io() which is only called to handle
RESTART_FROZEN_DISK_IO.

In former is called precisely once from the make_request_fn.
The later is never called by within the make_request_fn.

So there cannot be two allocations in the same call to the
make_request_fn, so a rescuer is not needed.

Allocations from drbd_md_io_bio_set are used for IO to the bitmap and
the activity log.  There are only accessed from worker threads and
workqueues, never directly from make_request_fn.
Again, the rescuer isn't needed.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/block/drbd/drbd_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index e2ed28d45ce1..4fe7c058a573 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2167,13 +2167,12 @@ static int drbd_create_mempools(void)
 		goto Enomem;
 
 	/* mempools */
-	drbd_io_bio_set = bioset_create(BIO_POOL_SIZE, 0, BIOSET_NEED_RESCUER);
+	drbd_io_bio_set = bioset_create(BIO_POOL_SIZE, 0, 0);
 	if (drbd_io_bio_set == NULL)
 		goto Enomem;
 
 	drbd_md_io_bio_set = bioset_create(DRBD_MIN_POOL_PAGES, 0,
-					   BIOSET_NEED_BVECS |
-					   BIOSET_NEED_RESCUER);
+					   BIOSET_NEED_BVECS);
 	if (drbd_md_io_bio_set == NULL)
 		goto Enomem;
 
-- 
2.14.0.rc0.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-29 22:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 22:16 [PATCH] drbd: remove BIOSET_NEED_RESCUER flag from drbd_{md_,}io_bio_set NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®