linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Mikulas Patocka <mpatocka@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH 3.18 18/23] dm bufio: drop the lock when doing GFP_NOIO allocation
Date: Tue, 10 Jul 2018 20:24:51 +0200	[thread overview]
Message-ID: <20180710182309.652294292@linuxfoundation.org> (raw)
In-Reply-To: <20180710182308.877332304@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 41c73a49df31151f4ff868f28fe4f129f113fa2c upstream.

If the first allocation attempt using GFP_NOWAIT fails, drop the lock
and retry using GFP_NOIO allocation (lock is dropped because the
allocation can take some time).

Note that we won't do GFP_NOIO allocation when we loop for the second
time, because the lock shouldn't be dropped between __wait_for_free_buffer
and __get_unclaimed_buffer.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/dm-bufio.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -761,6 +761,7 @@ enum new_flag {
 static struct dm_buffer *__alloc_buffer_wait_no_callback(struct dm_bufio_client *c, enum new_flag nf)
 {
 	struct dm_buffer *b;
+	bool tried_noio_alloc = false;
 
 	/*
 	 * dm-bufio is resistant to allocation failures (it just keeps
@@ -785,6 +786,15 @@ static struct dm_buffer *__alloc_buffer_
 		if (nf == NF_PREFETCH)
 			return NULL;
 
+		if (dm_bufio_cache_size_latch != 1 && !tried_noio_alloc) {
+			dm_bufio_unlock(c);
+			b = alloc_buffer(c, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
+			dm_bufio_lock(c);
+			if (b)
+				return b;
+			tried_noio_alloc = true;
+		}
+
 		if (!list_empty(&c->reserved_buffers)) {
 			b = list_entry(c->reserved_buffers.next,
 				       struct dm_buffer, lru_list);



  parent reply	other threads:[~2018-07-10 18:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10 18:24 [PATCH 3.18 00/23] 3.18.115-stable review Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 01/23] n_tty: Fix stall at n_tty_receive_char_special() Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 02/23] staging: android: ion: Return an ERR_PTR in ion_map_kernel Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 03/23] x86/boot: Fix early command-line parsing when matching at end Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 04/23] ubi: fastmap: Correctly handle interrupted erasures in EBA Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 05/23] netfilter: ebtables: handle string from userspace with care Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 06/23] atm: zatm: fix memcmp casting Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 07/23] net: qmi_wwan: Add Netgear Aircard 779S Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 08/23] net/sonic: Use dma_mapping_error() Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 09/23] scsi: sg: mitigate read/write abuse Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 10/23] cifs: Fix infinite loop when using hard mount option Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 11/23] ext4: make sure bitmaps and the inode table dont overlap with bg descriptors Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 12/23] ext4: clear i_data in ext4_inode_info when removing inline data Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 13/23] ext4: add more mount time checks of the superblock Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 14/23] HID: i2c-hid: Fix "incomplete report" noise Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 15/23] HID: debug: check length before copy_to_user() Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 16/23] media: cx25840: Use subdev host data for PLL override Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 17/23] dm bufio: avoid sleeping while holding the dm_bufio lock Greg Kroah-Hartman
2018-07-10 18:24 ` Greg Kroah-Hartman [this message]
2018-07-10 18:24 ` [PATCH 3.18 19/23] mtd: rawnand: mxc: set spare area size register explicitly Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 20/23] mtd: cfi_cmdset_0002: Change definition naming to retry write operation Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 21/23] mtd: cfi_cmdset_0002: Change erase functions to retry for error Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 22/23] mtd: cfi_cmdset_0002: Change erase functions to check chip good only Greg Kroah-Hartman
2018-07-10 18:24 ` [PATCH 3.18 23/23] netfilter: nf_log: dont hold nf_log_mutex during user access Greg Kroah-Hartman
2018-07-10 19:09 ` [PATCH 3.18 00/23] 3.18.115-stable review Nathan Chancellor
2018-07-10 20:19 ` Harsh 'Shandilya
2018-07-11 11:05   ` Greg Kroah-Hartman
2018-07-11 13:39 ` Guenter Roeck
2018-07-11 15:10 ` Shuah Khan

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=20180710182309.652294292@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@redhat.com \
    --cc=stable@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).