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:   Fri, 16 Sep 2022 13:12:49 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Xin Hao <xhao@...ux.alibaba.com>
Cc:     mike.kravetz@...cle.com, songmuchun@...edance.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] mm/hugetlb: add is_resv_equal_free() func

On Fri, 16 Sep 2022 14:41:27 +0800 Xin Hao <xhao@...ux.alibaba.com> wrote:

> In hugetlb.c file, there are several places to compare the values of
> 'h->free_huge_pages' and 'h->resv_huge_pages', it looks a bit messy, so
> there add a new is_resv_equal_free() func to do these.
> 
> ...
>
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1191,6 +1191,11 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
>  	return NULL;
>  }
> 
> +static inline bool is_resv_equal_free(struct hstate *h)

I'm not sure that's a well chosen name.  A better name would reflect
the *meaning* of free_huge_pages being equal to resv_huge_pages.  Maybe
something like reserves_exhausted()?

This would all be clearer if we'd bothered to document the fields of
struct hstate :(


> +{
> +	return (h->free_huge_pages - h->resv_huge_pages == 0) ? true : false;

	return h->free_huge_pages == h->resv_huge_pages;

> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ