Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp821286ybi; Sun, 30 Jun 2019 01:01:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU3qX/Xu9P/nH2lAKXu6zjJz4aAreCT3Z4h/v5rW1dfJZP34jBPTk1bbUx9KVoH9j7kTsa X-Received: by 2002:a63:dc02:: with SMTP id s2mr18342074pgg.286.1561881685362; Sun, 30 Jun 2019 01:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561881685; cv=none; d=google.com; s=arc-20160816; b=Kd235jkfAM/nmaNGV7ExGjJcCXAtisVP+3AieWbrdJAdSCcgo9rzFxv/cyp/ZabF7+ fikW+srE9AOZviUK5Y7hgTwOzQhK1S8Ir4JMc/ZjSRSc2l3Y4Bnk/SmYpHMpyrQ9qi5t r8lK86J+V2fQ2EB7hIBXAJX/TIziHcnkBWBSAExWr78ZSbirzsFyOAldmg2EZO+noHyC pNgNw82N25dgwMoNogyUk6Szt6wI8NjTeMDI2tyjYXq/nNvDraMtgWSUqZXkjtuMvxeq ZLLApx4ni9NNRGCIamP5g/if++QjPLfjolGMzJmbMgVbE8/kFEiB7sHgNKguEw54MFSH sCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pe03FkrBdknzSMi1BJ7D2IonOmPOSw8u72ZV3zS67vk=; b=c7FUycZ0y5sEKDVe0C+DUle3589+fZcNZZddqKyiwHTolR9hN4cZPs/UNfQxQoWq5p TOrtFJcAks+wrG1F4wNSmRi73gl+6QnqskA8gVS0Qyl8EOznIm/0ohJFYx/FjvwB4lGm kQjv5OpTGIjDfW+MWSy+K4dY6pKjZ0yIGx9EiU+o56PDQ+dSbb/SarPeAjPXguZgKy1U 8/pXm+zzp/B5totVSYaN2DIsjmnCB9kz0supn5bxGBcydEZb85i/qbidlvNLwXCSx/hJ smJGm6UwDUlERVU/xNZTKfvVld/NYPEaLO+pjsIZM2kVlkO1cqS97rIH6lqb4ijOisWn AJsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rSCmPaA3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d135si6580460pga.557.2019.06.30.01.01.09; Sun, 30 Jun 2019 01:01:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rSCmPaA3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbfF3H53 (ORCPT + 99 others); Sun, 30 Jun 2019 03:57:29 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39466 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbfF3H52 (ORCPT ); Sun, 30 Jun 2019 03:57:28 -0400 Received: by mail-pg1-f193.google.com with SMTP id 196so4510444pgc.6 for ; Sun, 30 Jun 2019 00:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pe03FkrBdknzSMi1BJ7D2IonOmPOSw8u72ZV3zS67vk=; b=rSCmPaA3Tt5oSbR8YeEqZLqTU9wKXjxK3j8JcnuFn/CLgYMKlAe8T2yM5V2VuoxHpU +PFl7JopgZN9CTcY0bnkfcokKmMlyWwSevqjEO9eVRXg6hHGweBdUXjOzLbe4S99zRbo gtNWDMZJJNfatXZ/tJbX1OW+n9nfpK0TX4Z8dgQaEGo3OjnfwwbXgmT35liDBpYngBNF /ZHQRXtLaNrKH7dbC8sTrGtT0+li7YPW+6CtHDdkZvhsHU87OjpJlTKteGLJ4qM6Ea9R dIqbxVmL8kN1ouhitirDiTh6qaDYbAGx48kIlLP9K4FmakIB5YB5bLPSb27PfSZcquLB 8GYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pe03FkrBdknzSMi1BJ7D2IonOmPOSw8u72ZV3zS67vk=; b=Xo+bVyqZeK1A7XSTV+2NpfcN2pSxLftOM0ukBn60JNBfIme6afJui73fZ5ruFfAOwD VwDkJXLc1Z4XP6xgCd/XXb1fCTjaRqPJUd5Jzd4UCsvnQ2oTwFmzB1f6i3mBuHB1hzUG SrbYBeJeqcA1zzpWLi/tHa+PSJZDkD2uXih6wiP3zbnc7cGbdP+wXj0qMrccjRJPklHT DlgcijudmNH2OMhI/YxqOJ1stlSZjTWjPRQDkw3SOW/GkRVUbdL75v5dxCewymRGechh Laq4gCM9qAbfugBlgFn6+8ZOwIMmfToeM4OWfSyvzgzpQ5W/Gj+wzRKG5cZjchZ+GNjP 7drw== X-Gm-Message-State: APjAAAXm8FnbTcc+UQIconzhhZ5Q7YEaLuBd7mSPyvz1iXA+8CabZ4YM G6YjJETI7RAF04hLiTKzpfM= X-Received: by 2002:a17:90a:bf08:: with SMTP id c8mr23664541pjs.75.1561881448164; Sun, 30 Jun 2019 00:57:28 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:648:b8c3:8577:bf2f:2]) by smtp.gmail.com with ESMTPSA id w10sm5989637pgs.32.2019.06.30.00.57.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 00:57:27 -0700 (PDT) From: Pengfei Li To: akpm@linux-foundation.org, peterz@infradead.org, urezki@gmail.com Cc: rpenyaev@suse.de, mhocko@suse.com, guro@fb.com, aryabinin@virtuozzo.com, rppt@linux.ibm.com, mingo@kernel.org, rick.p.edgecombe@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pengfei Li Subject: [PATCH 1/5] mm/vmalloc.c: Introduce a wrapper function of insert_vmap_area() Date: Sun, 30 Jun 2019 15:56:46 +0800 Message-Id: <20190630075650.8516-2-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190630075650.8516-1-lpf.vector@gmail.com> References: <20190630075650.8516-1-lpf.vector@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The red-black tree whose root is vmap_area_root is called the *BUSY* tree. Since function insert_vmap_area() is only used to add vmap area to the *BUSY* tree, so add wrapper functions insert_va_to_busy_tree for readability. Besides, rename insert_vmap_area to __insert_vmap_area to indicate that it should not be called directly. Signed-off-by: Pengfei Li --- mm/vmalloc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0f76cca32a1c..0a46be76c63b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -641,7 +641,7 @@ augment_tree_propagate_from(struct vmap_area *va) } static void -insert_vmap_area(struct vmap_area *va, +__insert_vmap_area(struct vmap_area *va, struct rb_root *root, struct list_head *head) { struct rb_node **link; @@ -651,6 +651,12 @@ insert_vmap_area(struct vmap_area *va, link_va(va, root, parent, link, head); } +static __always_inline void +insert_va_to_busy_tree(struct vmap_area *va) +{ + __insert_vmap_area(va, &vmap_area_root, &vmap_area_list); +} + static void insert_vmap_area_augment(struct vmap_area *va, struct rb_node *from, struct rb_root *root, @@ -1070,7 +1076,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size, va->va_start = addr; va->va_end = addr + size; va->flags = 0; - insert_vmap_area(va, &vmap_area_root, &vmap_area_list); + insert_va_to_busy_tree(va); spin_unlock(&vmap_area_lock); @@ -1871,7 +1877,7 @@ void __init vmalloc_init(void) va->va_start = (unsigned long)tmp->addr; va->va_end = va->va_start + tmp->size; va->vm = tmp; - insert_vmap_area(va, &vmap_area_root, &vmap_area_list); + insert_va_to_busy_tree(va); } /* @@ -3281,7 +3287,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, va->va_start = start; va->va_end = start + size; - insert_vmap_area(va, &vmap_area_root, &vmap_area_list); + insert_va_to_busy_tree(va); } spin_unlock(&vmap_area_lock); -- 2.21.0