Re: [PATCH v5 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-15 Thread Gao Xiang
On Tue, Mar 16, 2021 at 09:11:02AM +0800, Chao Yu wrote:
> On 2021/3/5 17:58, Huang Jianan via Linux-erofs wrote:
> > Currently, err would be treated as io error. Therefore, it'd be
> > better to ensure memory allocation during rolling decompression
> > to avoid such io error.
> > 
> > In the long term, we might consider adding another !Uptodate case
> > for such case.
> > 
> > Signed-off-by: Huang Jianan 
> > Signed-off-by: Guo Weichao 
> > ---
> >   fs/erofs/decompressor.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
> > index 1cb1ffd10569..3d276a8aad86 100644
> > --- a/fs/erofs/decompressor.c
> > +++ b/fs/erofs/decompressor.c
> > @@ -73,7 +73,8 @@ static int z_erofs_lz4_prepare_destpages(struct 
> > z_erofs_decompress_req *rq,
> > victim = availables[--top];
> > get_page(victim);
> > } else {
> > -   victim = erofs_allocpage(pagepool, GFP_KERNEL);
> > +   victim = erofs_allocpage(pagepool,
> > +GFP_KERNEL | __GFP_NOFAIL);
> > if (!victim)
> > return -ENOMEM;
> 
> A little bit weird that we still need to check return value of 
> erofs_allocpage()
> after we pass __GFP_NOFAIL parameter.

Yeah, good point! sorry I forgot that.

Jianan,
Could you take some time resending the next version with all new things
updated?... thus Chao could review easily, Thanks!

Thanks,
Gao Xiang

> 
> Thanks,
> 
> > set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);
> > 
> 



Re: [PATCH v5 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-15 Thread Chao Yu

On 2021/3/5 17:58, Huang Jianan via Linux-erofs wrote:

Currently, err would be treated as io error. Therefore, it'd be
better to ensure memory allocation during rolling decompression
to avoid such io error.

In the long term, we might consider adding another !Uptodate case
for such case.

Signed-off-by: Huang Jianan 
Signed-off-by: Guo Weichao 
---
  fs/erofs/decompressor.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index 1cb1ffd10569..3d276a8aad86 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -73,7 +73,8 @@ static int z_erofs_lz4_prepare_destpages(struct 
z_erofs_decompress_req *rq,
victim = availables[--top];
get_page(victim);
} else {
-   victim = erofs_allocpage(pagepool, GFP_KERNEL);
+   victim = erofs_allocpage(pagepool,
+GFP_KERNEL | __GFP_NOFAIL);
if (!victim)
return -ENOMEM;


A little bit weird that we still need to check return value of erofs_allocpage()
after we pass __GFP_NOFAIL parameter.

Thanks,


set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);



Re: [PATCH v5 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-15 Thread Gao Xiang
On Fri, Mar 05, 2021 at 05:58:39PM +0800, Huang Jianan via Linux-erofs wrote:
> Currently, err would be treated as io error. Therefore, it'd be
> better to ensure memory allocation during rolling decompression
> to avoid such io error.
> 
> In the long term, we might consider adding another !Uptodate case
> for such case.
> 
> Signed-off-by: Huang Jianan 
> Signed-off-by: Guo Weichao 

Reviewed-by: Gao Xiang 

Thanks,
Gao Xiang



[PATCH v5 1/2] erofs: avoid memory allocation failure during rolling decompression

2021-03-05 Thread Huang Jianan
Currently, err would be treated as io error. Therefore, it'd be
better to ensure memory allocation during rolling decompression
to avoid such io error.

In the long term, we might consider adding another !Uptodate case
for such case.

Signed-off-by: Huang Jianan 
Signed-off-by: Guo Weichao 
---
 fs/erofs/decompressor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index 1cb1ffd10569..3d276a8aad86 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -73,7 +73,8 @@ static int z_erofs_lz4_prepare_destpages(struct 
z_erofs_decompress_req *rq,
victim = availables[--top];
get_page(victim);
} else {
-   victim = erofs_allocpage(pagepool, GFP_KERNEL);
+   victim = erofs_allocpage(pagepool,
+GFP_KERNEL | __GFP_NOFAIL);
if (!victim)
return -ENOMEM;
set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);
-- 
2.25.1