From patchwork Thu Sep 1 12:00:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12962357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F9F3ECAAD1 for ; Thu, 1 Sep 2022 12:01:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 221808D0005; Thu, 1 Sep 2022 08:01:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BB9B8D0003; Thu, 1 Sep 2022 08:01:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB9248D0005; Thu, 1 Sep 2022 08:01:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AD6B98D0003 for ; Thu, 1 Sep 2022 08:01:06 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 779D5A9A1D for ; Thu, 1 Sep 2022 12:01:06 +0000 (UTC) X-FDA: 79863375732.06.B9BFC26 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf20.hostedemail.com (Postfix) with ESMTP id 9D0B41C0074 for ; Thu, 1 Sep 2022 12:01:05 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJKLz17V4znTZ8; Thu, 1 Sep 2022 19:58:35 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 1 Sep 2022 20:01:02 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 03/10] hugetlb: Use LIST_HEAD() to define a list head Date: Thu, 1 Sep 2022 20:00:23 +0800 Message-ID: <20220901120030.63318-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220901120030.63318-1-linmiaohe@huawei.com> References: <20220901120030.63318-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662033665; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yoxS4EhpxQucgKKY61vAF7r82tsD8i3zshGspWNGFnk=; b=xI+tejmQLlpFmOmLu9nlvggLFEztMBWQJZh4ufCyBq9kl8MWStfzLH9lXFmuIBF51TRGJ/ HfhM/WFl0cOGTjnmv4aQyNqC7UbbvnG9ym6hvV8Qf14fhOpkEfwQh0W6Tennd7aYTpO+k3 1ajbaH6y6gMwLllck6ITS4JQ4HwyNE0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662033665; a=rsa-sha256; cv=none; b=W/xMDA5As4m7uIW6QxXPam7lKkmGJgWSpyIE3BbPUcJeidpG0UUIMj1qiDX2TufbVdLM2C SUmVXCLhNipyEZnCFaMJTkl2QQbaWnH/gvnCfIz7fC5pwBQrwufaJYOf4p/dqNXiv8p0Gj yohRzhwu0SV7TlP1cFBQ3MM3oEnnQLY= Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam11 X-Stat-Signature: rwnhajr9ikk1ubuihot3an7kjeamdfsp X-Rspamd-Queue-Id: 9D0B41C0074 X-Rspam-User: X-HE-Tag: 1662033665-532861 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use LIST_HEAD() directly to define a list head to simplify the code. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0d63a7fda1d9..94cb81e9b4df 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: