linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zram_drv: allow reclaim on bio_alloc
       [not found] <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcas1p1.samsung.com>
@ 2021-09-06  5:29 ` Jaewon Kim
  2021-09-06  8:38   ` Christoph Hellwig
       [not found]   ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p6>
  0 siblings, 2 replies; 5+ messages in thread
From: Jaewon Kim @ 2021-09-06  5:29 UTC (permalink / raw)
  To: minchan, akpm; +Cc: linux-mm, linux-kernel, ytk.lee, jaewon31.kim, Jaewon Kim

The read_from_bdev_async is not called on atomic context. So GFP_NOIO is
available rather than GFP_ATOMIC. If there were reclaimable pages with
GFP_NOIO, we can avoid allocation failure and page fault failure.

Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fcaf2750f68f..53be528a39a2 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -587,7 +587,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
 {
 	struct bio *bio;
 
-	bio = bio_alloc(GFP_ATOMIC, 1);
+	bio = bio_alloc(GFP_NOIO|__GFP_HIGHMEM, 1);
 	if (!bio)
 		return -ENOMEM;
 
-- 
2.17.1


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

* Re: [PATCH] zram_drv: allow reclaim on bio_alloc
  2021-09-06  5:29 ` [PATCH] zram_drv: allow reclaim on bio_alloc Jaewon Kim
@ 2021-09-06  8:38   ` Christoph Hellwig
       [not found]   ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p6>
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-09-06  8:38 UTC (permalink / raw)
  To: Jaewon Kim; +Cc: minchan, akpm, linux-mm, linux-kernel, ytk.lee, jaewon31.kim

On Mon, Sep 06, 2021 at 02:29:26PM +0900, Jaewon Kim wrote:
> The read_from_bdev_async is not called on atomic context. So GFP_NOIO is
> available rather than GFP_ATOMIC. If there were reclaimable pages with
> GFP_NOIO, we can avoid allocation failure and page fault failure.
> 
> Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
> ---
>  drivers/block/zram/zram_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index fcaf2750f68f..53be528a39a2 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -587,7 +587,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
>  {
>  	struct bio *bio;
>  
> -	bio = bio_alloc(GFP_ATOMIC, 1);
> +	bio = bio_alloc(GFP_NOIO|__GFP_HIGHMEM, 1);

Passing __GFP_HIGHMEM to bio_alloc does not make any sense whatsoever.

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

* RE:(2) [PATCH] zram_drv: allow reclaim on bio_alloc
       [not found]   ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p6>
@ 2021-09-06  9:14     ` Jaewon Kim
  2021-09-07 17:00       ` (2) " Minchan Kim
       [not found]       ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p2>
  0 siblings, 2 replies; 5+ messages in thread
From: Jaewon Kim @ 2021-09-06  9:14 UTC (permalink / raw)
  To: Christoph Hellwig, Jaewon Kim
  Cc: minchan, akpm, linux-mm, linux-kernel, YongTaek Lee, jaewon31.kim

> 
> 
>--------- Original Message ---------
>Sender : Christoph Hellwig <hch@infradead.org>
>Date : 2021-09-06 17:39 (GMT+9)
>Title : Re: [PATCH] zram_drv: allow reclaim on bio_alloc
> 
>On Mon, Sep 06, 2021 at 02:29:26PM +0900, Jaewon Kim wrote:
>> The read_from_bdev_async is not called on atomic context. So GFP_NOIO is
>> available rather than GFP_ATOMIC. If there were reclaimable pages with
>> GFP_NOIO, we can avoid allocation failure and page fault failure.
>> 
>> Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
>> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
>> ---
>>  drivers/block/zram/zram_drv.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
>> index fcaf2750f68f..53be528a39a2 100644
>> --- a/drivers/block/zram/zram_drv.c
>> +++ b/drivers/block/zram/zram_drv.c
>> @@ -587,7 +587,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
>>  {
>>          struct bio *bio;
>>  
>> -        bio = bio_alloc(GFP_ATOMIC, 1);
>> +        bio = bio_alloc(GFP_NOIO|__GFP_HIGHMEM, 1);
> 
>Passing __GFP_HIGHMEM to bio_alloc does not make any sense whatsoever.
> 
Correct, let me remove __GFP_HIGHMEM if I send v2 patch.
Thank you

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

* Re: (2) [PATCH] zram_drv: allow reclaim on bio_alloc
  2021-09-06  9:14     ` Jaewon Kim
@ 2021-09-07 17:00       ` Minchan Kim
       [not found]       ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p2>
  1 sibling, 0 replies; 5+ messages in thread
From: Minchan Kim @ 2021-09-07 17:00 UTC (permalink / raw)
  To: Jaewon Kim
  Cc: Christoph Hellwig, akpm, linux-mm, linux-kernel, YongTaek Lee,
	jaewon31.kim

Hi Jaewon,

On Mon, Sep 06, 2021 at 06:14:48PM +0900, Jaewon Kim wrote:
> > 
> > 
> >--------- Original Message ---------
> >Sender : Christoph Hellwig <hch@infradead.org>
> >Date : 2021-09-06 17:39 (GMT+9)
> >Title : Re: [PATCH] zram_drv: allow reclaim on bio_alloc
> > 
> >On Mon, Sep 06, 2021 at 02:29:26PM +0900, Jaewon Kim wrote:
> >> The read_from_bdev_async is not called on atomic context. So GFP_NOIO is
> >> available rather than GFP_ATOMIC. If there were reclaimable pages with
> >> GFP_NOIO, we can avoid allocation failure and page fault failure.
> >> 
> >> Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
> >> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>

Looks reasonable to me.
Feel free to add after dealing with Christoph's comment.

Acked-by: Minchan Kim <minchan@kernel.org>

Thank you.

> >> ---
> >>  drivers/block/zram/zram_drv.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> >> index fcaf2750f68f..53be528a39a2 100644
> >> --- a/drivers/block/zram/zram_drv.c
> >> +++ b/drivers/block/zram/zram_drv.c
> >> @@ -587,7 +587,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
> >>  {
> >>          struct bio *bio;
> >>  
> >> -        bio = bio_alloc(GFP_ATOMIC, 1);
> >> +        bio = bio_alloc(GFP_NOIO|__GFP_HIGHMEM, 1);
> > 
> >Passing __GFP_HIGHMEM to bio_alloc does not make any sense whatsoever.
> > 
> Correct, let me remove __GFP_HIGHMEM if I send v2 patch.
> Thank you

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

* RE:(3) [PATCH] zram_drv: allow reclaim on bio_alloc
       [not found]       ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p2>
@ 2021-09-08  0:41         ` Jaewon Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaewon Kim @ 2021-09-08  0:41 UTC (permalink / raw)
  To: Minchan Kim, Jaewon Kim
  Cc: Christoph Hellwig, akpm, linux-mm, linux-kernel, YongTaek Lee,
	jaewon31.kim

> 
> 
>--------- Original Message ---------
>Sender : Minchan Kim <minchan@kernel.org>
>Date : 2021-09-08 02:00 (GMT+9)
>Title : Re: (2) [PATCH] zram_drv: allow reclaim on bio_alloc
> 
>Hi Jaewon,
> 
>On Mon, Sep 06, 2021 at 06:14:48PM +0900, Jaewon Kim wrote:
>> > 
>> > 
>> >--------- Original Message ---------
>> >Sender : Christoph Hellwig <hch@infradead.org>
>> >Date : 2021-09-06 17:39 (GMT+9)
>> >Title : Re: [PATCH] zram_drv: allow reclaim on bio_alloc
>> > 
>> >On Mon, Sep 06, 2021 at 02:29:26PM +0900, Jaewon Kim wrote:
>> >> The read_from_bdev_async is not called on atomic context. So GFP_NOIO is
>> >> available rather than GFP_ATOMIC. If there were reclaimable pages with
>> >> GFP_NOIO, we can avoid allocation failure and page fault failure.
>> >> 
>> >> Reported-by: Yong-Taek Lee <ytk.lee@samsung.com>
>> >> Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
> 
>Looks reasonable to me.
>Feel free to add after dealing with Christoph's comment.
> 
>Acked-by: Minchan Kim <minchan@kernel.org>
> 
>Thank you.

Thank you, I will send v2 patch soon.

> 
>> >> ---
>> >>  drivers/block/zram/zram_drv.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >> 
>> >> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
>> >> index fcaf2750f68f..53be528a39a2 100644
>> >> --- a/drivers/block/zram/zram_drv.c
>> >> +++ b/drivers/block/zram/zram_drv.c
>> >> @@ -587,7 +587,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
>> >>  {
>> >>          struct bio *bio;
>> >>  
>> >> -        bio = bio_alloc(GFP_ATOMIC, 1);
>> >> +        bio = bio_alloc(GFP_NOIO|__GFP_HIGHMEM, 1);
>> > 
>> >Passing __GFP_HIGHMEM to bio_alloc does not make any sense whatsoever.
>> > 
>> Correct, let me remove __GFP_HIGHMEM if I send v2 patch.
>> Thank you
> 

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

end of thread, other threads:[~2021-09-08  0:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcas1p1.samsung.com>
2021-09-06  5:29 ` [PATCH] zram_drv: allow reclaim on bio_alloc Jaewon Kim
2021-09-06  8:38   ` Christoph Hellwig
     [not found]   ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p6>
2021-09-06  9:14     ` Jaewon Kim
2021-09-07 17:00       ` (2) " Minchan Kim
     [not found]       ` <CGME20210906052847epcas1p1f53f1ad04ad785d53f64eef150969c34@epcms1p2>
2021-09-08  0:41         ` Jaewon Kim

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