From patchwork Tue Aug 29 08:11:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 13368660 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 989DDC83F14 for ; Tue, 29 Aug 2023 08:11:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C88328003A; Tue, 29 Aug 2023 04:11:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 276C4280037; Tue, 29 Aug 2023 04:11:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CA0328003A; Tue, 29 Aug 2023 04:11:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F0292280037 for ; Tue, 29 Aug 2023 04:11:49 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C5545B27C9 for ; Tue, 29 Aug 2023 08:11:49 +0000 (UTC) X-FDA: 81176423538.17.9CDE6D3 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf25.hostedemail.com (Postfix) with ESMTP id D935FA0020 for ; Tue, 29 Aug 2023 08:11:47 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QxThSYRw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=urezki@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1693296708; 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=ZR6SvlG6RVqjpwTXvW3wIJv5GQWXT7NLdjvAZjLWLsM=; b=cBSIN1SQ7HcOf/oNjDt17KdprEpd65hJaMZuKni2lTSMjcsZsX9xEFD0m1RsKrfB8YcwIJ Er7cvSFSzdeS6aRwrzPlzcw45wvreHF/Rn+su6HxJoB5zgmKZ/LmOXBVc6XPcCVt0zwc7W S9XVJUdpUOkkvTai6weG6eGToJqMbnU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=QxThSYRw; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=urezki@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1693296708; a=rsa-sha256; cv=none; b=I0avkyUWndcXbFGVMYoJ+FcJYxL6ES7oR1LDtjT3TRTEjlwMwt9VOmRUe6M8F/cGmhxcu+ oOZfQKGQ8hcwK3i1xbiwz5Xlqe7sKxsLN4U2XzBL+6Hi/DMmgUlhgLFFIyIpdTCcmJzLsZ hpBjN8gz/RiC1ZzzLjG53p1HpF5We74= Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-4ff09632194so6578598e87.2 for ; Tue, 29 Aug 2023 01:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693296706; x=1693901506; 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=ZR6SvlG6RVqjpwTXvW3wIJv5GQWXT7NLdjvAZjLWLsM=; b=QxThSYRwDtcE6nVhtK77Bm0vpeVqL1+GW7jmP7pJXd2x1LSjjVHUSOzUkmQ50ayv1A Wk8PDFDtcTBiDNVJyGosExWMqHj0UnI11W5Howqzjd/g6CiGQZrRGR4cSSv151uKSnAF pMN4P9e398gh/DtM2IioA/kT2cgyNgezI62AjKiJNw/sm/8YPwqFO5ear/XGoPX9ZJ3r cydejULmZlzX3LouEZVkLDFq5LpxOEG7Qhil0DCO2+8SSC9q8je8V6+goqRnyIaBvyhI UgMFNWk7WtmxZoO+GcfZ3aR8jO+hBkTj6pnIxKqEebqGcKrtimaMyY/nopENrKiqtx2G r5Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693296706; x=1693901506; 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=ZR6SvlG6RVqjpwTXvW3wIJv5GQWXT7NLdjvAZjLWLsM=; b=F8iZez+SEUx0J1BGNAoFT3Yk0BWOhBw2dv/I3KOzyhlEBG5+exgnXY9tgUKEKxhugj qtVFBfuH/nnKqyudBgnpoIdEQR4wxG7qspu7hO+6CTouHldvWevz32GI8v1J97ZMyR88 r3rB3QC+Jmr7M3GLqdLCVU7QvYilH172tKzOX2eEfQH6b5yn+l2lVencCStHLUA/7D3t MhEZcaNQRL3vwsLUIFTGp/GVbPTXazMCLaETWTI8+g8F+D0bl21bvYm47+OVuRUoBF3/ n8lW5bOhAO2VcBAexWOFkc1xw3HjPQT5ihrqSTFz08sxvqBnB5H3/QZUOlIK5VEec+/G b+oA== X-Gm-Message-State: AOJu0YwLMVK/2iH9G4X6gKBHftdA+aX5uw3tERVyAJubI5mIoRyY/lZh Rf9b+iLE79pnNsVAe2Y+hlsw51zMBKPy5g== X-Google-Smtp-Source: AGHT+IGEnacQTpxADckRzHoYIXvZaUhpJE6tHjbYNN3uY99M3n0FzgtKGoq4Q7h2iZ7uuaPLaYrrjQ== X-Received: by 2002:a05:6512:304f:b0:500:b890:fb38 with SMTP id b15-20020a056512304f00b00500b890fb38mr5023278lfb.24.1693296706241; Tue, 29 Aug 2023 01:11:46 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id f25-20020a19ae19000000b004fbad341442sm1868026lfc.97.2023.08.29.01.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Aug 2023 01:11:45 -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 , Christoph Hellwig Subject: [PATCH v2 3/9] mm: vmalloc: Move vmap_init_free_space() down in vmalloc.c Date: Tue, 29 Aug 2023 10:11:36 +0200 Message-Id: <20230829081142.3619-4-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230829081142.3619-1-urezki@gmail.com> References: <20230829081142.3619-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: mx6fi7desw5buiah7trad6moc69wizhk X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D935FA0020 X-HE-Tag: 1693296707-874927 X-HE-Meta: U2FsdGVkX19Yaf5AemPs+P9oxUSfxicxXtFQc2mcbXgnaCnUJk7Iqxd1cmPEVXC+lfhIq806dYw2aaDTA991gI9Vwo46Sf5VIX7ywr9btTDYks0PvK8wN5059DKBkBWwpAJwwt8pmdoxyjLv62prtqMoVydFTXQjBUxUG6HVp7QUhR7ap+jl9kx2oGx/ysfI9+Z3oA96KYMbHxC74E6z6MDrAZBDecWfuJNdcLhFlBjJvgazvNZPzcSoXNC8qkoxSfyxu2pb04TJscMPCn1RhM5bVES7l2lp+tRsqdaHcpzg6OASHEgQT/B7YwQakw+HaM1kM+Z4ubsr1vH7lzNdaWMceRF8KprUU7AItBxYH4BYsp1kZskIwJYo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K8dilHrMhDbBdUEb+G5s83RI4H0zPyRus8= 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: 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: Christoph Hellwig Reviewed-by: Lorenzo Stoakes Signed-off-by: Uladzislau Rezki (Sony) Reviewed-by: Baoquan He --- mm/vmalloc.c | 82 ++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 09e315f8ea34..b7deacca1483 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) { @@ -4443,6 +4402,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;