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, 12 Sep 2022 23:37:38 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Brian Geffon <bgeffon@...gle.com>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Minchan Kim <minchan@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Nitin Gupta <ngupta@...are.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>
Subject: Re: [PATCH] zram: do not waste zram_table_entry flags bits

On (22/09/12 10:20), Brian Geffon wrote:
> >  /*
> > - * The lower ZRAM_FLAG_SHIFT bits of table.flags is for
> > - * object size (excluding header), the higher bits is for
> > - * zram_pageflags.
> > - *
> > - * zram is mainly used for memory efficiency so we want to keep memory
> > - * footprint small so we can squeeze size and flags into a field.
> > + * ZRAM is mainly used for memory efficiency so we want to keep memory
> > + * footprint small and thus squeeze size and flags into a flags member.
> >   * The lower ZRAM_FLAG_SHIFT bits is for object size (excluding header),
> > - * the higher bits is for zram_pageflags.
> > + * which cannot be larger than PAGE_SIZE (requiring PAGE_SHIFT bits),
> > + * the higher bits are for zram_pageflags.
> >   */
> > -#define ZRAM_FLAG_SHIFT 24
> > +#define ZRAM_FLAG_SHIFT (PAGE_SHIFT + 1)
> 
> Why not just hard code 16 with an explanation that it cannot be
> increased further using the analysis you did in the other thread? It's
> going to be tricky to reason about how many free flag bits actually
> remain with PAGE_SHIFT across all architectures, especially given we
> have no architecture specific flags.

Well, zram should not make any assumptions on arch code. How do
we know that PAGE_SHIFT 16 is the max value we will ever have?
Some arch can come around someday and use PAGE_SHIFT say, 18,
and we won't be aware of it (using hardcoded value of 16) until
someone hits a really hard to debug problem in zram.

Powered by blists - more mailing lists