From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4059C433E0 for ; Wed, 27 May 2020 20:51:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B8A9C20890 for ; Wed, 27 May 2020 20:51:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drVk745L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8A9C20890 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 222FF800B7; Wed, 27 May 2020 16:51:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D9E780010; Wed, 27 May 2020 16:51:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0017E800B7; Wed, 27 May 2020 16:51:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id D22CD80010 for ; Wed, 27 May 2020 16:51:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9221A180AD804 for ; Wed, 27 May 2020 20:51:06 +0000 (UTC) X-FDA: 76863693732.18.women63_60f2ba54b613a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 76C3810063AB6 for ; Wed, 27 May 2020 20:51:06 +0000 (UTC) X-HE-Tag: women63_60f2ba54b613a X-Filterd-Recvd-Size: 4920 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 May 2020 20:51:06 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id w10so30713883ljo.0 for ; Wed, 27 May 2020 13:51:05 -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=OmqE1cLIwHpE8JGzINfwEZTtrgAXgsJu/fEWYlPrDEY=; b=drVk745LRWLryhFg3ZtxBGKcWOOHTcyc8bs1BpYQLj4kEeO2aiqzwvm6H4ZelTQOhD JeL5DNb1rgwjMXIozFMRJaFGetE3q+jZ7/zBRbmTfS0nuXlSH/ZbSd6SOU60/XsAk5/Q F0yCqeX2OueKBUxP26pGNbPlLf+ZkrNEW9ER9NR3hjz5xNMKFdhYVOhNuGJ+8rfKM43o 8xY+zwXUrDe/V3wi5LOA/wVegzMUine3gO0+HGjtGeod2dJs1Ct1yj1M+N/S3pQSfzi5 C1wzVgK1TFvxUrQ8GqpROrDQt/iPhUvMmu+CSaMfwp9puM0SAWuMo1U8+TdXZ/j1NCbu 0bDg== 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=OmqE1cLIwHpE8JGzINfwEZTtrgAXgsJu/fEWYlPrDEY=; b=TBHyxM8DZI+S+1iL8DCDanCWIHKSyBILeV9WoawlqV+FAc+iDgY0fRH3nKUDc6YvJy xougEYG/8gqdIolpz+0Z74QrMxXhZaBWqM3ttlbnEGWwZMEU5WkAal3FhpOP8m8sZEB/ RyVz4qh8MKdsIBlfLDEIlPEMYyPfYkF+M+wiyihyyXY9l56LxrDbc1txjqmm7X313Z3C lZKdo3Aam9IiT7XVGBfi4vgQfy/CSLMoNLHUYG8UdH9AFh7dgUV0NjVcsEHJRreqTX4v npeq+L6VlSlQKlr266dtT8N1jct7Yv6pF2b3rhpU2V/v5SPwP+MdO0G03B5L47G8sb0x ILsA== X-Gm-Message-State: AOAM533v9ZS8EhXJvPdPdarHS6pJIAA4l6aw5cG34lhfqlcvAfgtM+Uz zJuZL1jbLb/mlW23VqCdGJc= X-Google-Smtp-Source: ABdhPJwCwQrSw/zunwzVa/PiIHTusXHW4ZfltBsjfWuWSwh5DRWilqn62KbStOdr3Kjzckw34M32tw== X-Received: by 2002:a05:651c:338:: with SMTP id b24mr3553506ljp.118.1590612664836; Wed, 27 May 2020 13:51:04 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id z78sm1045919lfc.80.2020.05.27.13.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 13:51:04 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Uladzislau Rezki , Hillf Danton , Michal Hocko , Matthew Wilcox , Oleksiy Avramchenko , Steven Rostedt Subject: [PATCH 3/3] mm/vmalloc: switch to "propagate()" callback Date: Wed, 27 May 2020 22:50:54 +0200 Message-Id: <20200527205054.1696-3-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200527205054.1696-1-urezki@gmail.com> References: <20200527205054.1696-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 76C3810063AB6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable 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: An augment_tree_propagate_from() function uses its own implementation that populates a tree from the specified node toward a root node. >From the other hand the RB_DECLARE_CALLBACKS_MAX macro provides the "propagate()" callback that does exactly the same. Having two similar functions does not make sense and is redundant. Reuse "built in" functionality to the macros. So the code size gets reduced. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 62d48f5e7105..e3d5b8d1f987 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -633,25 +633,12 @@ augment_tree_propagate_check(void) static __always_inline void augment_tree_propagate_from(struct vmap_area *va) { - struct rb_node *node =3D &va->rb_node; - unsigned long new_va_sub_max_size; - - while (node) { - va =3D rb_entry(node, struct vmap_area, rb_node); - new_va_sub_max_size =3D compute_subtree_max_size(va); - - /* - * If the newly calculated maximum available size of the - * subtree is equal to the current one, then it means that - * the tree is propagated correctly. So we have to stop at - * this point to save cycles. - */ - if (va->subtree_max_size =3D=3D new_va_sub_max_size) - break; - - va->subtree_max_size =3D new_va_sub_max_size; - node =3D rb_parent(&va->rb_node); - } + /* + * Populate the tree from bottom towards the root until + * the calculated maximum available size of checked node + * is equal to its current one. + */ + free_vmap_area_rb_augment_cb_propagate(&va->rb_node, NULL); =20 #if DEBUG_AUGMENT_PROPAGATE_CHECK augment_tree_propagate_check(); --=20 2.20.1