Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2786908rwd; Mon, 22 May 2023 04:29:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ixWPe0ZnR7DgoetE1vsE5e+UfQIlEFffzJutZf1+xuQKQMaFEHJSDNcvYqWNSNioac7fZ X-Received: by 2002:a17:902:e884:b0:1af:a143:b0e8 with SMTP id w4-20020a170902e88400b001afa143b0e8mr6267741plg.27.1684754978597; Mon, 22 May 2023 04:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684754978; cv=none; d=google.com; s=arc-20160816; b=qVw9D+btN5zPfTxwfNWGE03ULXEYjiJ26PlCQ8qEyS45eXUfweH7ppSbrRBQjcFb8w HP9BZjt/DL0CbOdohQcvMDUTxUTpgMw7sRt76skz7zLRTrr00YMEkOXbXF8Go9CxMSQl vh3W20lr4k/2fChqwibnIJEbpxIEbd9Oa6+KBB5LitZXfkBszfSZS1D+dC261CvbBynn yGqTaWgIEdKyYuk1vgEAgOK4/GrpnD+OSBjxFYJPKL/LggXCsCACC16/xjKHGpG9ikVb Y3T/t1+GA8lNxZlnq2vgQQU8tAj3bvgPG3mZc1MlNTrpgUQ4k10WY3Yn17rwgNqJc3Gd VfLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sNtfrgi/quI4TC521AyXgwFWeKCoK/ixdzMUo1Hjyag=; b=cdVF5+wiGwSBV6OFXfYH9ayEF4h42yXU0rS4Sr9JJoSuHtXxkpmAPVhwqlMOItG3JG 81ZkQleuP90lEz/yDvmfAJdpSR3RSmTgPGOJ4j5XW2GmCXvmMS08da/drhnGAD4KuWg4 zkmEDq1ua20hnPIjJzOKdbDWR45lHiAlsrp0g3GfeHKYmP5JVuLXi+XjO6PE+oljT40w OPYWriphvd3WK/FdDTuyNMYy0qh+rNN27n30LvVcn4ykRAVnn5A/4GqvoAvRHOjBmBK3 qefQ2pitYej+EhDS/vcSSsrXVQFHQ8pyvCA9f3z+nD3AhBzofoje3GD01rSBa3Zilscb 1jeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="GkR4/dm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902f7c700b001ab23cb930bsi2166140plw.417.2023.05.22.04.29.26; Mon, 22 May 2023 04:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="GkR4/dm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233225AbjEVLOl (ORCPT + 99 others); Mon, 22 May 2023 07:14:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232979AbjEVLN5 (ORCPT ); Mon, 22 May 2023 07:13:57 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2186F40ED for ; Mon, 22 May 2023 04:08:56 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-96f683e8855so488847866b.2 for ; Mon, 22 May 2023 04:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684753734; x=1687345734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sNtfrgi/quI4TC521AyXgwFWeKCoK/ixdzMUo1Hjyag=; b=GkR4/dm/njRpBQa+KVraZ+7JOlNk7shw4BEphYd/T4MuYuRj9UeHx7STRIkE9qZ3ZV 2oXVDGHFmqIOsQbp8tUn9Y00B46Baxi7Y8dneLOn6DV42d85pL1sEsY68+QnjQ1f2vmJ aDPoq7XcD9rLqsdzZWq3ANly5HjVSjJ29W0p5d8YhCo15pKjujxSAlIMECHBsZDAyuMN tLgaKTuxmHTfb/eGGN0rAdS+/lKXxYAVJyynl/B47Xw/ZEaCyR2lt1lpmnS2FpLh3BXG MgpEFyKwNZW3Q2xr0xt2mb+dk5JSHw7+52EgYFgJevxmwbWAu2YUPoOjuE6sjvnpUmYm ZEog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684753734; x=1687345734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sNtfrgi/quI4TC521AyXgwFWeKCoK/ixdzMUo1Hjyag=; b=FTZ3yfk6jS6vKVXbW+/KmL42W+/A/0LU6hHyovEVYmhf1EB2QBqDn19pmtG8/mQ4Ei hWnhTRwkh55HHMi+wxdu1FsFpjA2IMpVzKW4uEMJpuTBOfdz0qoMzFsnbA5tS90o7Mdm xS2KE+rY+MPoRCrl8f+74hO79VwqCNVdMSfze9cbbqkR2dW8h6Egn78MKFoidwQxY6fB ld/s2KdjEBesyC13rGxOYctu4CZrQVwStEu3Rrcubc3z/MAgkWNUf95rOdTWRelFOQyK mJWrQtwbRt+gzwre07P2ubdUVjVSQ1vlPEot5vhEub/qi/0oJB2am4yKleZXnXwoNjmi xztQ== X-Gm-Message-State: AC+VfDwI+MLuZ2nmwbQF63GjwJOKw9BOOGtMsx7ULvMErwYslkD6CjuK FjXKwbA2Ue0DCk3DX1KRldA= X-Received: by 2002:a17:907:d21:b0:965:4b43:11f1 with SMTP id gn33-20020a1709070d2100b009654b4311f1mr9711913ejc.3.1684753734338; Mon, 22 May 2023 04:08:54 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id lx19-20020a170906af1300b0094f07545d40sm2949453ejb.220.2023.05.22.04.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 04:08:54 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: linux-mm@kvack.org, Andrew Morton Cc: LKML , Baoquan He , Lorenzo Stoakes , Christoph Hellwig , Matthew Wilcox , "Liam R . Howlett" , Dave Chinner , "Paul E . McKenney" , Joel Fernandes , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 3/9] mm: vmalloc: Move vmap_init_free_space() down in vmalloc.c Date: Mon, 22 May 2023 13:08:43 +0200 Message-Id: <20230522110849.2921-4-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230522110849.2921-1-urezki@gmail.com> References: <20230522110849.2921-1-urezki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A vmap_init_free_space() is a function that setups a vmap space and is considered as part of initialization phase. Since a main entry which is vmalloc_init(), has been moved down in vmalloc.c it makes sense to follow the pattern. There is no a functional change as a result of this patch. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 82 ++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 5f900efec6a9..19dcffb0d563 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2416,47 +2416,6 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align) kasan_populate_early_vm_area_shadow(vm->addr, vm->size); } -static void vmap_init_free_space(void) -{ - unsigned long vmap_start = 1; - const unsigned long vmap_end = ULONG_MAX; - struct vmap_area *busy, *free; - - /* - * B F B B B F - * -|-----|.....|-----|-----|-----|.....|- - * | The KVA space | - * |<--------------------------------->| - */ - list_for_each_entry(busy, &vmap_area_list, list) { - if (busy->va_start - vmap_start > 0) { - free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); - if (!WARN_ON_ONCE(!free)) { - free->va_start = vmap_start; - free->va_end = busy->va_start; - - insert_vmap_area_augment(free, NULL, - &free_vmap_area_root, - &free_vmap_area_list); - } - } - - vmap_start = busy->va_end; - } - - if (vmap_end - vmap_start > 0) { - free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); - if (!WARN_ON_ONCE(!free)) { - free->va_start = vmap_start; - free->va_end = vmap_end; - - insert_vmap_area_augment(free, NULL, - &free_vmap_area_root, - &free_vmap_area_list); - } - } -} - static inline void setup_vmalloc_vm_locked(struct vm_struct *vm, struct vmap_area *va, unsigned long flags, const void *caller) { @@ -4271,6 +4230,47 @@ module_init(proc_vmalloc_init); #endif +static void vmap_init_free_space(void) +{ + unsigned long vmap_start = 1; + const unsigned long vmap_end = ULONG_MAX; + struct vmap_area *busy, *free; + + /* + * B F B B B F + * -|-----|.....|-----|-----|-----|.....|- + * | The KVA space | + * |<--------------------------------->| + */ + list_for_each_entry(busy, &vmap_area_list, list) { + if (busy->va_start - vmap_start > 0) { + free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); + if (!WARN_ON_ONCE(!free)) { + free->va_start = vmap_start; + free->va_end = busy->va_start; + + insert_vmap_area_augment(free, NULL, + &free_vmap_area_root, + &free_vmap_area_list); + } + } + + vmap_start = busy->va_end; + } + + if (vmap_end - vmap_start > 0) { + free = kmem_cache_zalloc(vmap_area_cachep, GFP_NOWAIT); + if (!WARN_ON_ONCE(!free)) { + free->va_start = vmap_start; + free->va_end = vmap_end; + + insert_vmap_area_augment(free, NULL, + &free_vmap_area_root, + &free_vmap_area_list); + } + } +} + void __init vmalloc_init(void) { struct vmap_area *va; -- 2.30.2