linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Subject: [PATCH] brd: add cond_resched to brd_free_pages
Date: Thu, 9 May 2019 12:54:09 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1905091252300.19234@file01.intranet.prod.int.rdu2.redhat.com> (raw)

The loop that frees all the pages can take unbounded amount of time, so
add cond_resched() to it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/block/brd.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-4.19.41/drivers/block/brd.c
===================================================================
--- linux-4.19.41.orig/drivers/block/brd.c	2019-01-22 12:26:42.000000000 +0100
+++ linux-4.19.41/drivers/block/brd.c	2019-05-09 17:09:11.000000000 +0200
@@ -157,6 +157,8 @@ static void brd_free_pages(struct brd_de
 
 		pos++;
 
+		cond_resched();
+
 		/*
 		 * This assumes radix_tree_gang_lookup always returns as
 		 * many pages as possible. If the radix-tree code changes,

             reply	other threads:[~2019-05-09 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 16:54 Mikulas Patocka [this message]
2019-05-09 16:56 ` [PATCH] brd: add cond_resched to brd_free_pages Jens Axboe
2019-05-09 18:50   ` Mikulas Patocka
2019-05-09 18:51     ` Jens Axboe

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=alpine.LRH.2.02.1905091252300.19234@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).