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] [day] [month] [year] [list]
Message-ID: <CAB=+i9SuKDT61txyyr2Nrh_jXYc7vt5_GwQUYqCEPMvQiPdMJQ@mail.gmail.com>
Date:   Sun, 3 Dec 2023 15:08:10 +0900
From:   Hyeonggon Yoo <42.hyeyoo@...il.com>
To:     chengming.zhou@...ux.dev
Cc:     vbabka@...e.cz, cl@...ux.com, penberg@...nel.org,
        willy@...radead.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
        akpm@...ux-foundation.org, roman.gushchin@...ux.dev,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Chengming Zhou <zhouchengming@...edance.com>
Subject: Re: [RFC PATCH v4 5/9] slub: Introduce freeze_slab()

On Tue, Oct 31, 2023 at 11:09 PM <chengming.zhou@...ux.dev> wrote:
>
> From: Chengming Zhou <zhouchengming@...edance.com>
>
> We will have unfrozen slabs out of the node partial list later, so we
> need a freeze_slab() function to freeze the partial slab and get its
> freelist.
>
> Signed-off-by: Chengming Zhou <zhouchengming@...edance.com>
> Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
> ---
>  mm/slub.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 1880b483350e..edf567971679 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3098,6 +3098,33 @@ static inline void *get_freelist(struct kmem_cache *s, struct slab *slab)
>         return freelist;
>  }
>
> +/*
> + * Freeze the partial slab and return the pointer to the freelist.
> + */
> +static inline void *freeze_slab(struct kmem_cache *s, struct slab *slab)
> +{
> +       struct slab new;
> +       unsigned long counters;
> +       void *freelist;
> +
> +       do {
> +               freelist = slab->freelist;
> +               counters = slab->counters;
> +
> +               new.counters = counters;
> +               VM_BUG_ON(new.frozen);
> +
> +               new.inuse = slab->objects;
> +               new.frozen = 1;
> +
> +       } while (!slab_update_freelist(s, slab,
> +               freelist, counters,
> +               NULL, new.counters,
> +               "freeze_slab"));
> +
> +       return freelist;
> +}
> +

Looks good to me,
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@...il.com>

Thanks!

>  /*
>   * Slow path. The lockless freelist is empty or we need to perform
>   * debugging duties.
> --
> 2.20.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ