From mboxrd@z Thu Jan 1 00:00:00 1970 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 DFB70ECAAD4 for ; Sat, 27 Aug 2022 01:47:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CD46940008; Fri, 26 Aug 2022 21:47:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57D0A940007; Fri, 26 Aug 2022 21:47:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 444AD940008; Fri, 26 Aug 2022 21:47:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3532D940007 for ; Fri, 26 Aug 2022 21:47:21 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1685F1C64A8 for ; Sat, 27 Aug 2022 01:47:21 +0000 (UTC) X-FDA: 79843685082.31.B5A6380 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by imf04.hostedemail.com (Postfix) with ESMTP id 8987040026 for ; Sat, 27 Aug 2022 01:47:20 +0000 (UTC) Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661564839; h=from:from: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=NH8AOWNO+r3zUi9PCSA6JOJZDOYEZSeALqyhYw+ro0o=; b=HFudeuhD98HlTqi6MSQlwC2+oYFpw1u3aYrJYAhVQwMw2WmV3FMyNq28GjJwvGYjKePsAY I42UN+ZAp+EWyrhxjK8lqRA0coQxh3Gk5LQ3m7Yc19KW00M3HclNwkt30GF394mbRBSeOZ u4R7d8WBsG5Rj1Gj0WQ7iONBRIcfK5o= MIME-Version: 1.0 Subject: Re: [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20220826092422.39591-4-linmiaohe@huawei.com> Date: Sat, 27 Aug 2022 09:47:14 +0800 Cc: Andrew Morton , mike.kravetz@oracle.com, Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <8D011A6F-F557-4519-852C-80BBDE53E630@linux.dev> References: <20220826092422.39591-1-linmiaohe@huawei.com> <20220826092422.39591-4-linmiaohe@huawei.com> To: Miaohe Lin X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661564840; 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:dkim-signature; bh=NH8AOWNO+r3zUi9PCSA6JOJZDOYEZSeALqyhYw+ro0o=; b=QerP2mhFYk9ywe3UkCkJLskLZ7hZyn+yIXGGSuEjhg039PF4Exl2RQqmZ8FLSQk0iikn4I Sz8q6deORXWwq6fnm/zvDtBm6G36YmXW6s5cTrKk5ZcuGRGj5/lsXSuF9yLljAhe/oOrVn smtNYXroUlPaRR+NB8ewH8zDBm3X7PE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=HFudeuhD; spf=pass (imf04.hostedemail.com: domain of muchun.song@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=muchun.song@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661564840; a=rsa-sha256; cv=none; b=VcuC2x9kPTrSpR52C2uABsL1lHnGuG/qVKoRAW8/pEYFsnmduP7p+ncaVF1z0oLEWtdpaS m+JRCyYQunDrH2+5ZgTP7jiPOfRvu4p9Rcx1OBqFzTOnlw9ES7VvEvJE587O04f87BOwbZ jPbKRn9XXFF7id4qmA/pog8aJZ3nV4w= X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=HFudeuhD; spf=pass (imf04.hostedemail.com: domain of muchun.song@linux.dev designates 188.165.223.204 as permitted sender) smtp.mailfrom=muchun.song@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspamd-Server: rspam05 X-Stat-Signature: c3c7h8dudhdii5xxroug38otahssprxw X-Rspamd-Queue-Id: 8987040026 X-HE-Tag: 1661564840-718584 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: > On Aug 26, 2022, at 17:24, Miaohe Lin wrote: >=20 > We can avoid unneeded WRITE_ONCE() overhead by using LIST_HEAD() to = define > a list head. IIUC, the overhead doesn=E2=80=99t change. Right? I=E2=80=99m fine with your changes. Reviewed-by: Muchun Song Thanks. >=20 > Signed-off-by: Miaohe Lin > --- > mm/hugetlb.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) >=20 > 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 =3D 0, i =3D 0; > struct file_region *trg =3D NULL, *rg =3D NULL; >=20 > VM_BUG_ON(regions_needed < 0); >=20 > - 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) > } >=20 > allocated =3D 0; > - INIT_LIST_HEAD(&surplus_list); >=20 > ret =3D -ENOMEM; > retry: > --=20 > 2.23.0 >=20 >=20