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]
Message-Id: <8D011A6F-F557-4519-852C-80BBDE53E630@linux.dev>
Date:   Sat, 27 Aug 2022 09:47:14 +0800
From:   Muchun Song <muchun.song@...ux.dev>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, mike.kravetz@...cle.com,
        Muchun Song <songmuchun@...edance.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head



> On Aug 26, 2022, at 17:24, Miaohe Lin <linmiaohe@...wei.com> wrote:
> 
> We can avoid unneeded WRITE_ONCE() overhead by using LIST_HEAD() to define
> a list head.

IIUC, the overhead doesn’t change. Right?

I’m fine with your changes.

Reviewed-by: Muchun Song <songmuchun@...edance.com>

Thanks.

> 
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
> mm/hugetlb.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 24f580ddf130..b3e6592247a3 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -459,14 +459,12 @@ static int allocate_file_region_entries(struct resv_map *resv,
> 					int regions_needed)
> 	__must_hold(&resv->lock)
> {
> -	struct list_head allocated_regions;
> +	LIST_HEAD(allocated_regions);
> 	int to_allocate = 0, i = 0;
> 	struct file_region *trg = NULL, *rg = NULL;
> 
> 	VM_BUG_ON(regions_needed < 0);
> 
> -	INIT_LIST_HEAD(&allocated_regions);
> -
> 	/*
> 	 * Check for sufficient descriptors in the cache to accommodate
> 	 * the number of in progress add operations plus regions_needed.
> @@ -2352,7 +2350,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
> static int gather_surplus_pages(struct hstate *h, long delta)
> 	__must_hold(&hugetlb_lock)
> {
> -	struct list_head surplus_list;
> +	LIST_HEAD(surplus_list);
> 	struct page *page, *tmp;
> 	int ret;
> 	long i;
> @@ -2367,7 +2365,6 @@ static int gather_surplus_pages(struct hstate *h, long delta)
> 	}
> 
> 	allocated = 0;
> -	INIT_LIST_HEAD(&surplus_list);
> 
> 	ret = -ENOMEM;
> retry:
> -- 
> 2.23.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ