lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 17 Apr 2023 15:15:06 +0800
From:   Yue Hu <zbestahu@...il.com>
To:     Gao Xiang <hsiangkao@...ux.alibaba.com>
Cc:     xiang@...nel.org, chao@...nel.org, linux-erofs@...ts.ozlabs.org,
        jefflexu@...ux.alibaba.com, linux-kernel@...r.kernel.org,
        huyue2@...lpad.com, zhangwen@...lpad.com
Subject: Re: [PATCH] erofs: remove unneeded icur field from struct
 z_erofs_decompress_frontend

On Mon, 17 Apr 2023 15:00:25 +0800
Gao Xiang <hsiangkao@...ux.alibaba.com> wrote:

> On 2023/4/17 14:52, Gao Xiang wrote:
> > 
> > 
> > On 2023/4/17 14:41, Yue Hu wrote:  
> >> From: Yue Hu <huyue2@...lpad.com>
> >>
> >> The icur field is only used in z_erofs_try_inplace_io(). Let's just use
> >> a local variable instead. And no need to check if the pcluster is inline
> >> when setting icur since inline page cannot be used for inplace I/O.  
> 
> Where do we check if the pcluster is inline?

       /* since file-backed online pages are traversed in reverse order */
       fe->icur = z_erofs_pclusterpages(fe->pcl);


static inline unsigned int z_erofs_pclusterpages(struct z_erofs_pcluster *pcl)
{
        if (z_erofs_is_inline_pcluster(pcl))
                return 1;
	[...]

> 
> >>
> >> Signed-off-by: Yue Hu <huyue2@...lpad.com>  
> > 
> > Nope, it's a behavior change.
> > Other users could feed more inplace I/O pages before I/O submission
> > to reduce memory consumption, it's common when applying stress model
> > in low memory scenarios.  
> 
> Oh, I misread it.  I think it can be done in this way although
> each following users will now rescan the whole array all the time.
> 
> Reviewed-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
> 
> > 
> > Thanks,
> > Gao Xiang
> >   
> >> ---
> >>   fs/erofs/zdata.c | 13 +++++--------
> >>   1 file changed, 5 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> >> index f759152feffa..f8bf2b227942 100644
> >> --- a/fs/erofs/zdata.c
> >> +++ b/fs/erofs/zdata.c
> >> @@ -554,9 +554,6 @@ struct z_erofs_decompress_frontend {
> >>       /* used for applying cache strategy on the fly */
> >>       bool backmost;
> >>       erofs_off_t headoffset;
> >> -
> >> -    /* a pointer used to pick up inplace I/O pages */
> >> -    unsigned int icur;
> >>   };
> >>   #define DECOMPRESS_FRONTEND_INIT(__i) { \
> >> @@ -707,11 +704,13 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,
> >>                      struct z_erofs_bvec *bvec)
> >>   {
> >>       struct z_erofs_pcluster *const pcl = fe->pcl;
> >> +    /* file-backed online pages are traversed in reverse order */  
> 
> Although please help refine the comment below:
> 
> 	/* scan & fill inplace I/O pages in the reverse order */

Ok, will refine it in v2.

> 
> Thanks,
> Gao Xiang
> 
> >> +    unsigned int icur = pcl->pclusterpages;
> >> -    while (fe->icur > 0) {
> >> -        if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page,
> >> +    while (icur > 0) {
> >> +        if (!cmpxchg(&pcl->compressed_bvecs[--icur].page,
> >>                    NULL, bvec->page)) {
> >> -            pcl->compressed_bvecs[fe->icur] = *bvec;
> >> +            pcl->compressed_bvecs[icur] = *bvec;
> >>               return true;
> >>           }
> >>       }
> >> @@ -877,8 +876,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe)
> >>       }
> >>       z_erofs_bvec_iter_begin(&fe->biter, &fe->pcl->bvset,
> >>                   Z_EROFS_INLINE_BVECS, fe->pcl->vcnt);
> >> -    /* since file-backed online pages are traversed in reverse order */
> >> -    fe->icur = z_erofs_pclusterpages(fe->pcl);
> >>       return 0;
> >>   }  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ