linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <mike.kravetz@oracle.com>,
	<songmuchun@bytedance.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head
Date: Fri, 26 Aug 2022 17:24:15 +0800	[thread overview]
Message-ID: <20220826092422.39591-4-linmiaohe@huawei.com> (raw)
In-Reply-To: <20220826092422.39591-1-linmiaohe@huawei.com>

We can avoid unneeded WRITE_ONCE() overhead by using LIST_HEAD() to define
a list head.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.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


  parent reply	other threads:[~2022-08-26  9:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  9:24 [PATCH 00/10] A few cleanup patches for hugetlb Miaohe Lin
2022-08-26  9:24 ` [PATCH 01/10] hugetlb: make hugetlb_cma_check() static Miaohe Lin
2022-08-27  1:40   ` Muchun Song
2022-08-26  9:24 ` [PATCH 02/10] hugetlb: Use helper macro SZ_1K Miaohe Lin
2022-08-27  1:40   ` Muchun Song
2022-08-26  9:24 ` Miaohe Lin [this message]
2022-08-27  1:47   ` [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head Muchun Song
2022-08-27  2:27     ` Miaohe Lin
2022-08-27  2:48       ` Muchun Song
2022-08-27  6:38         ` Miaohe Lin
2022-08-26  9:24 ` [PATCH 04/10] hugetlb: Use sizeof() to get the array size Miaohe Lin
2022-08-27  1:43   ` Muchun Song
2022-08-26  9:24 ` [PATCH 05/10] hugetlb: Use helper {huge_pte|pmd}_lock() Miaohe Lin
2022-08-27  1:48   ` Muchun Song
2022-08-26  9:24 ` [PATCH 06/10] hugetlb: pass NULL to kobj_to_hstate() if nid is unused Miaohe Lin
2022-08-27  1:49   ` Muchun Song
2022-08-26  9:24 ` [PATCH 07/10] hugetlb: kill hugetlbfs_pagecache_page() Miaohe Lin
2022-08-27  1:52   ` Muchun Song
2022-08-26  9:24 ` [PATCH 08/10] hugetlb: remove unneeded SetHPageVmemmapOptimized() Miaohe Lin
2022-08-27  1:35   ` Muchun Song
2022-08-27  2:18     ` Miaohe Lin
2022-08-27  2:56       ` Muchun Song
2022-08-26  9:24 ` [PATCH 09/10] hugetlb: remove meaningless BUG_ON(huge_pte_none()) Miaohe Lin
2022-08-27  2:03   ` Muchun Song
2022-08-26  9:24 ` [PATCH 10/10] hugetlb: make hugetlb selects SYSFS if !SYSCTL Miaohe Lin
2022-08-27  1:59   ` Muchun Song
2022-08-27  2:34     ` Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220826092422.39591-4-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=songmuchun@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).