From patchwork Tue Jan 2 18:46:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13509274 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 ACF47C47073 for ; Tue, 2 Jan 2024 18:46:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 691CC6B01F7; Tue, 2 Jan 2024 13:46:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 64B996B01FA; Tue, 2 Jan 2024 13:46:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4938E6B01FE; Tue, 2 Jan 2024 13:46:43 -0500 (EST) 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 2C0D66B01F7 for ; Tue, 2 Jan 2024 13:46:43 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 03039401FB for ; Tue, 2 Jan 2024 18:46:42 +0000 (UTC) X-FDA: 81635252286.27.6B6499B Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf02.hostedemail.com (Postfix) with ESMTP id 1F5C080005 for ; Tue, 2 Jan 2024 18:46:40 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="OlvXkU/l"; spf=pass (imf02.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704221201; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MyVIBHsk2yf4bdOQXWkGleZVntvAopzQ+wazdTKAsLk=; b=M8ZAxYT3Wn2KAyvMF83LkrP1cMo7MGcsnMXf3clbW8MvGreef+jqJfOLcU46+0PpeYJaEG p0qVMSj4gGZhZ/LLTy9flVKxDeij+8yg8NMlG3X6i2O3Soc2hNG27qdrZvjzZD/Es4tS4S pCgX3I6J7y+URmJiqPD+Wmf/eGDDb3w= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="OlvXkU/l"; spf=pass (imf02.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704221201; a=rsa-sha256; cv=none; b=7mqZEozt6qTuBhJmp65gH+Il32ueewZKXBasTnDPQ46Dvb+oiAUqCpa1v0f/IGcRxmB71B I8Wln1MLW2oL8THU9YmatjWE78Bnv4g607UXnbpve3O9aq0KRqfu86FAXwQgp6H+n1WGtP yRSHRVBQCxVVWzl9sVr0bVoyUTniHjM= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50e7288a6e1so7913224e87.2 for ; Tue, 02 Jan 2024 10:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704221199; x=1704825999; darn=kvack.org; 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=MyVIBHsk2yf4bdOQXWkGleZVntvAopzQ+wazdTKAsLk=; b=OlvXkU/ls3dnCdpkNa5YRv3UmIeJY+P2ekyXjvNlzt6bGVMV1XsuJlx8Hts32ASV60 d9J+mXPt1r3MOWzIOeFZ1wx6TfMq3oeFOuiPOWh4b2V+i/1IprGfnGuq9wU/UIRCrIPw 53UWXt/aJe2q0Ym0FRyHAWtWhKEckG+1d225F9GU6R3jnaiwjhTHx7zmlCcofbXfNhdy uCyMp5J2mK0KAgd8iIZR2d3ixItwlvWkqBuV36RBt1cXscN3sTDVIPXww4+HV/U+ZW0C eYZp+eCYN4wJZknRkySqfVpl5eFVcdvJGktN/tupe+SaOTcTqClNkzOCoYSmome3H/9p 6nOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704221199; x=1704825999; 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=MyVIBHsk2yf4bdOQXWkGleZVntvAopzQ+wazdTKAsLk=; b=C4J7QOhC/Ail35JSQMxjv/JxW4vETX3nPQ7Z+8ogVyweDltV834TvVfpLHo1snYYiu amgQYke7Xznh4pqbZToP8n6N6rHEv1EmIMFl+1pnOh41y/uEuloeQn3o1av5RWe9Xxn2 y7wfm76+4iZfTAOyRA5pu8Da76mRNR+GEcBHuUxqG66utthuJYVTRooDNxNykmMgAgGC zwfBuP5K2OPMp9IfcHK3CH0Mvu5s2kGZHsxXdjYgdl6lQec2PdY2FBVu0n4fSxS7uGRK KO6MpnAuSUvUE0iJnED+mnz612oPMCzF9vWerHa+4E6i+/mg0NFzlkkUzOMpjm8Ch1bk cudg== X-Gm-Message-State: AOJu0Yx7Dn/+i0YTn0ME/Bf+snu9lYMBNxZlUK2O0YjGECMB2iWQtGJz 6G3C3K/DSVd2vueEsrvXeGVyRO81ZN2aDA== X-Google-Smtp-Source: AGHT+IGk2c4cJ37LTpQvZZNmS0KxjEDGtzNNytmQ3n3FUXtipuMauWJG2kN4yaiFW3Ij1oRt/VBGdg== X-Received: by 2002:ac2:4e43:0:b0:50b:c57e:1418 with SMTP id f3-20020ac24e43000000b0050bc57e1418mr6636354lfr.16.1704221199512; Tue, 02 Jan 2024 10:46:39 -0800 (PST) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id q1-20020ac246e1000000b0050e7be886d9sm2592656lfo.56.2024.01.02.10.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 10:46:39 -0800 (PST) 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 , Christoph Hellwig Subject: [PATCH v3 03/11] mm: vmalloc: Move vmap_init_free_space() down in vmalloc.c Date: Tue, 2 Jan 2024 19:46:25 +0100 Message-Id: <20240102184633.748113-4-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240102184633.748113-1-urezki@gmail.com> References: <20240102184633.748113-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1F5C080005 X-Rspam-User: X-Stat-Signature: twngrizn8g89xu63f56jjsm438mk8g74 X-Rspamd-Server: rspam01 X-HE-Tag: 1704221200-338360 X-HE-Meta: U2FsdGVkX19nq6o8IPNPcixv7KTfNHqfL/v5cPjVzA5bs+/9K9hg3Z7EPVz9xdtces3ZwblfQZgBLExEs4y0+tUee5fHFxhikfsZmLTpAM25A78cgUhJ5Me/jBc1kZu8KnXqBrH1xE6ICAfiBM4HHKcoqfepNv7O3qqJVnYbQLf0eEhuY2J73OsRNkWp6vzp96QENPMVg4iDiLcTtdjPD6N8djF21bU4szqCU/zQpO6fS9K01Hb4c9eNQ0POR57xJvzpmlyww8MjoamXaCOHrsEFxBLWIXsUX3vgrycw6AhTePUAw8icOW5CZdlSoG/6q4Kglk43nIEhiPg5F0mrLq8WaC2ups/1ie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XkOD2eGCNzzRcSoo8zBh3mXTnzd2U0yPmoIy2qsIN53SmpHp7yXZRIRxYLUZqqN4SkiAcxFY 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: 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. Reviewed-by: Baoquan He Reviewed-by: Christoph Hellwig Reviewed-by: Lorenzo Stoakes 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 10f289e86512..06bd843d18ae 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2512,47 +2512,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) { @@ -4465,6 +4424,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;