linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
@ 2018-12-11 12:08 Shin'ichiro Kawasaki
  2018-12-11 13:43 ` Jens Axboe
  2018-12-11 22:53 ` Damien Le Moal
  0 siblings, 2 replies; 6+ messages in thread
From: Shin'ichiro Kawasaki @ 2018-12-11 12:08 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: Damien.LeMoal, Matias.Bjorling, shinichiro.kawasaki

null_blk_zoned creation fails if the number of zones specified is equal to or is
smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
such a small number of zones, the required memory size for all zones descriptors
fits in a single page, and the page order for alloc_pages_node() is zero. Allow
this value in blk_alloc_zones() for the allocation to succeed.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 block/blk-zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 13ba2011a306..a327bef07642 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -378,7 +378,7 @@ static struct blk_zone *blk_alloc_zones(int node, unsigned int *nr_zones)
 	struct page *page;
 	int order;
 
-	for (order = get_order(size); order > 0; order--) {
+	for (order = get_order(size); order >= 0; order--) {
 		page = alloc_pages_node(node, GFP_NOIO | __GFP_ZERO, order);
 		if (page) {
 			*nr_zones = min_t(unsigned int, *nr_zones,
-- 
2.19.2


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

* Re: [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
  2018-12-11 12:08 [PATCH] block: Fix null_blk_zoned creation failure with small number of zones Shin'ichiro Kawasaki
@ 2018-12-11 13:43 ` Jens Axboe
  2018-12-11 22:55   ` Damien Le Moal
  2018-12-11 22:53 ` Damien Le Moal
  1 sibling, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2018-12-11 13:43 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block; +Cc: Damien.LeMoal, Matias.Bjorling

On 12/11/18 5:08 AM, Shin'ichiro Kawasaki wrote:
> null_blk_zoned creation fails if the number of zones specified is equal to or is
> smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
> such a small number of zones, the required memory size for all zones descriptors
> fits in a single page, and the page order for alloc_pages_node() is zero. Allow
> this value in blk_alloc_zones() for the allocation to succeed.

Looks good to me, this looks like 4.20 material.

-- 
Jens Axboe


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

* Re: [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
  2018-12-11 12:08 [PATCH] block: Fix null_blk_zoned creation failure with small number of zones Shin'ichiro Kawasaki
  2018-12-11 13:43 ` Jens Axboe
@ 2018-12-11 22:53 ` Damien Le Moal
  1 sibling, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2018-12-11 22:53 UTC (permalink / raw)
  To: Shinichiro Kawasaki, axboe, linux-block; +Cc: Matias Bjorling

On 2018/12/11 21:08, Shin'ichiro Kawasaki wrote:
> null_blk_zoned creation fails if the number of zones specified is equal to or is
> smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
> such a small number of zones, the required memory size for all zones descriptors
> fits in a single page, and the page order for alloc_pages_node() is zero. Allow
> this value in blk_alloc_zones() for the allocation to succeed.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  block/blk-zoned.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 13ba2011a306..a327bef07642 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -378,7 +378,7 @@ static struct blk_zone *blk_alloc_zones(int node, unsigned int *nr_zones)
>  	struct page *page;
>  	int order;
>  
> -	for (order = get_order(size); order > 0; order--) {
> +	for (order = get_order(size); order >= 0; order--) {
>  		page = alloc_pages_node(node, GFP_NOIO | __GFP_ZERO, order);
>  		if (page) {
>  			*nr_zones = min_t(unsigned int, *nr_zones,
> 

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
  2018-12-11 13:43 ` Jens Axboe
@ 2018-12-11 22:55   ` Damien Le Moal
  2018-12-11 23:19     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Damien Le Moal @ 2018-12-11 22:55 UTC (permalink / raw)
  To: Jens Axboe, Shinichiro Kawasaki, linux-block; +Cc: Matias Bjorling

On 2018/12/11 22:44, Jens Axboe wrote:
> On 12/11/18 5:08 AM, Shin'ichiro Kawasaki wrote:
>> null_blk_zoned creation fails if the number of zones specified is equal to or is
>> smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
>> such a small number of zones, the required memory size for all zones descriptors
>> fits in a single page, and the page order for alloc_pages_node() is zero. Allow
>> this value in blk_alloc_zones() for the allocation to succeed.
> 
> Looks good to me, this looks like 4.20 material.

Yes, this is a fix for commit bf5054569653 "block: Introduce
blk_revalidate_disk_zones()" that was included in 4.20 merge window.

Thanks !

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
  2018-12-11 22:55   ` Damien Le Moal
@ 2018-12-11 23:19     ` Jens Axboe
  2018-12-11 23:21       ` Damien Le Moal
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2018-12-11 23:19 UTC (permalink / raw)
  To: Damien Le Moal, Shinichiro Kawasaki, linux-block; +Cc: Matias Bjorling

On 12/11/18 3:55 PM, Damien Le Moal wrote:
> On 2018/12/11 22:44, Jens Axboe wrote:
>> On 12/11/18 5:08 AM, Shin'ichiro Kawasaki wrote:
>>> null_blk_zoned creation fails if the number of zones specified is equal to or is
>>> smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
>>> such a small number of zones, the required memory size for all zones descriptors
>>> fits in a single page, and the page order for alloc_pages_node() is zero. Allow
>>> this value in blk_alloc_zones() for the allocation to succeed.
>>
>> Looks good to me, this looks like 4.20 material.
> 
> Yes, this is a fix for commit bf5054569653 "block: Introduce
> blk_revalidate_disk_zones()" that was included in 4.20 merge window.

If only the patch already had a Fixes tag!

Queued up for 4.20.

-- 
Jens Axboe


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

* Re: [PATCH] block: Fix null_blk_zoned creation failure with small number of zones
  2018-12-11 23:19     ` Jens Axboe
@ 2018-12-11 23:21       ` Damien Le Moal
  0 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2018-12-11 23:21 UTC (permalink / raw)
  To: Jens Axboe, Shinichiro Kawasaki, linux-block; +Cc: Matias Bjorling

On 2018/12/12 8:19, Jens Axboe wrote:
> On 12/11/18 3:55 PM, Damien Le Moal wrote:
>> On 2018/12/11 22:44, Jens Axboe wrote:
>>> On 12/11/18 5:08 AM, Shin'ichiro Kawasaki wrote:
>>>> null_blk_zoned creation fails if the number of zones specified is equal to or is
>>>> smaller than 64 due to a memory allocation failure in blk_alloc_zones(). With
>>>> such a small number of zones, the required memory size for all zones descriptors
>>>> fits in a single page, and the page order for alloc_pages_node() is zero. Allow
>>>> this value in blk_alloc_zones() for the allocation to succeed.
>>>
>>> Looks good to me, this looks like 4.20 material.
>>
>> Yes, this is a fix for commit bf5054569653 "block: Introduce
>> blk_revalidate_disk_zones()" that was included in 4.20 merge window.
> 
> If only the patch already had a Fixes tag!

Yes, sorry about that. I told Shinichiro to not forget adding it.

> Queued up for 4.20.

Thank you.

-- 
Damien Le Moal
Western Digital Research

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

end of thread, other threads:[~2018-12-11 23:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 12:08 [PATCH] block: Fix null_blk_zoned creation failure with small number of zones Shin'ichiro Kawasaki
2018-12-11 13:43 ` Jens Axboe
2018-12-11 22:55   ` Damien Le Moal
2018-12-11 23:19     ` Jens Axboe
2018-12-11 23:21       ` Damien Le Moal
2018-12-11 22:53 ` Damien Le Moal

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).