From patchwork Wed Aug 28 04:12:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13780488 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 CF0B0C5474A for ; Wed, 28 Aug 2024 04:04:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF5A86B0083; Wed, 28 Aug 2024 00:04:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA5B46B0085; Wed, 28 Aug 2024 00:04:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B942D6B0088; Wed, 28 Aug 2024 00:04:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A105A6B0083 for ; Wed, 28 Aug 2024 00:04:42 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BE163AAE13 for ; Wed, 28 Aug 2024 04:04:41 +0000 (UTC) X-FDA: 82500312762.14.F367695 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf08.hostedemail.com (Postfix) with ESMTP id 4FE88160006 for ; Wed, 28 Aug 2024 04:04:38 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724817793; 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: references; bh=Kdai/Sxb96PitYqyffNsi/+5n8tEhMwiZYSlYS8KTco=; b=cZTvNdEkpNGYOfnG31b9+xWqDT8MErwIKgyEPM0qqnnh9DNM2kPMC8HjGvYPSlkKH+lx/z 7WwkM2vp0uc09VtbEO7h5vfe+sbFC1+xopFBRHQ06ZhtXyEqOhLu6ehD3meKj6Dfg9JaE+ tbvpfkD5Q/QPvVOIJdWkuzH2QAmjD9g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724817793; a=rsa-sha256; cv=none; b=XTSu3KWmj3Wt07SbmrqOmqNtdb4RbziNxQZpcWcTZ4FqFyiKJ7TyecKPYXNs7B0XSDyUbJ 0Ok4Sk592SAlqYDBENgGdxg8/U70GLP7sJmB5O/HJprUS5nM68jfK1W4uPVtcHrxDD5xbH edgddRM24+l9KEUX9+V8AjsdCQq0KpE= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of lihongbo22@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=lihongbo22@huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WtrQJ0Frpz2DbYw; Wed, 28 Aug 2024 12:04:24 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 041101402CF; Wed, 28 Aug 2024 12:04:35 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 28 Aug 2024 12:04:34 +0800 From: Hongbo Li To: , , CC: , Subject: [PATCH -next v2] mm: make use of the helper macro LIST_HEAD() Date: Wed, 28 Aug 2024 12:12:16 +0800 Message-ID: <20240828041216.1222582-1-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) X-Rspamd-Queue-Id: 4FE88160006 X-Stat-Signature: ir3qx4tgjk4ijfso9rxzdmwrxjnc68jj X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724817878-96036 X-HE-Meta: U2FsdGVkX1/UcPkrHrdoXVWVGACQcIqYqLTNmW7A3jekmUw5KqXgOaB3CqZZsbHJ0IS9LSWHgcAOM0k3ln6mtj1HH7EjUyyX8pclYaYzGkIfOM8PNQLIVfuEGmz6u9Ohv5V7AFDwVLqk6z5ntrY9TNm9NL2XnCbKF+5AZls+CvffZ7FQWfZzHdXTAEVTELPGm3htvUqk6A4oeowWaw5a+gVGYRzUuvc5dv+zQYsV7KHqRfcwoTNMgCRcONNsiCm2uFvmR1zZ3qP8xhKsh6xctCiVeR1ZahyMCzTSn4HicOS9vFtauQbLioi66Kq3vbnOUKiEEyouXoisndBVYWzjjxWif6tCuk8lugk5He6TpB/JBGExzqpSfs7JMRAcnSCS9oudODkyGHfgWyRnMMASqQMeZfAk6Tv47URri+6MHb3McTe1scxX5rOzW9WE+hOHSN1EM08l4biXAcOjQm2YdE5HDtJ1TJ53q/PNUZkBqQmCLWa+9qIpxg1cVhjP9CXm3BEXz8mLU2gH+XFwbBtj587ho+piM9SSmVmZO4Ep0tgIPRsZJcFCKHxth+DlthkxQKDnjdSdV1mfcwp6VBalym4bCI/yUw/tZFpaUh6lfcL7b+sk6w59NTkbW2JwnfiTGhbpAKOnV0hHhwvocb9ckGGI8/+nriURorkZWnNMeLFRBKDqcoVq908aDPHQA0I2/Snnx3ubPqCHOR8UkJVTPbRfdUiBEp6oK+9n5ejXUpLJR/XelciEyKDo9HaO/3jRyUSuJAYPd8zW4qsD096XK8C8y/1QtBu5+8ADREv+MckflzidFWnnUZCGRSBbdFjfirg+lXsUg3qLKeiB874sMqAFg5J8nS0MH/AWpfqyYXj8Ib0wUIDaZS50yJ+uZjdzevUpGmRx+72f4TVbDLhH4+/ypTaDn5xZxg7uX3lXnIapjttvItP4FQ92tBOWx9xTh/1sztuvk8XdcbP2hXv 1zEdn2ck dUHOO0z/2njrdpju/en67TSeOXu7ldZJ8jVhF03Q+bDa2pNMoeotBKRCEDGHXIpz4d3GXTpw/M1NnE6/cpnssMJsW1tUDjLiZ1FFdBC8/eUQpwXHo37/ZZIDlU00bDUJu/JFnrwnjqfPuY7UKoHswQ/XQYbPz9nCktXoC3/ucr6LVz12/CC188vHAYlTKpbMjrXPlJUgJ2fD4XJEP02mzUNjuUlm9u9FI+Csm8cBEwcleOHt4oQ7RlLRu3g== 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: List-Subscribe: List-Unsubscribe: list_head can be initialized automatically with LIST_HEAD() instead of calling INIT_LIST_HEAD(). Here we can simplify the code. Signed-off-by: Hongbo Li Reviewed-by: Uladzislau Rezki (Sony) --- - v2: - Also adjust decay_list according to Uladzislau's suggestion. - v1: https://lore.kernel.org/linux-mm/20240827015724.620110-1-lihongbo22@huawei.com/T/ --- mm/vmalloc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3f9b6bd707d2..6fc736f74ae7 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2131,23 +2131,18 @@ reclaim_list_global(struct list_head *head) static void decay_va_pool_node(struct vmap_node *vn, bool full_decay) { + LIST_HEAD(decay_list); + struct rb_root decay_root = RB_ROOT; struct vmap_area *va, *nva; - struct list_head decay_list; - struct rb_root decay_root; unsigned long n_decay; int i; - decay_root = RB_ROOT; - INIT_LIST_HEAD(&decay_list); - for (i = 0; i < MAX_VA_SIZE_PAGES; i++) { - struct list_head tmp_list; + LIST_HEAD(tmp_list); if (list_empty(&vn->pool[i].head)) continue; - INIT_LIST_HEAD(&tmp_list); - /* Detach the pool, so no-one can access it. */ spin_lock(&vn->pool_lock); list_replace_init(&vn->pool[i].head, &tmp_list);