Message ID | 1522810579-7466-6-git-send-email-hejianet@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21389602C8 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 4 Apr 2018 03:01:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DD3928764 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 4 Apr 2018 03:01:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 000302876D; Wed, 4 Apr 2018 03:01:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3B0A528764 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 4 Apr 2018 03:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=xYPRLlBHV2qzjaExSk0d5q0Vv6lbDg2Y/iv7QAyVDvQ=; b=NVK/SNX82vWmv40f4+mpZb4cVJ gprdhml+LZLGWJ8PzXhUFESGVSKlifyOQJyqVwOA5SNGDJilUbjmobyfe7f/8TrN6/imXVKITNIWQ 2WUBeXOxLprJuG1pfV4Wqivfj39azfmxYjklWT57VQmdcKgCwKaFAw0w18lcLXO4LQgfr9MdhRWiv 0aFoL9KXJEshUZUK0Kd/eIE9amxCfkt3AP7dANkxzPJ21sUNb0CsctiIHGHPrenQhoQxU0/qiZUfx V6DO7tRvGVGlALXOaLF+wRN7nqdDVuCGiTdstjmzXXcLQGf3BV1YGJ1oFlIWiDnG0mErdMQRBEJHk hjmJQrQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3YfK-0001zB-83; Wed, 04 Apr 2018 03:00:50 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3YcY-0007dN-Ck for linux-arm-kernel@lists.infradead.org; Wed, 04 Apr 2018 02:58:16 +0000 Received: by mail-pl0-x241.google.com with SMTP id u11-v6so12029870plq.1 for <linux-arm-kernel@lists.infradead.org>; Tue, 03 Apr 2018 19:57:48 -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; bh=ykNuYTs3vQADVQ7BqYp+potI3FMwH8+qeszIvIfF+1w=; b=ihS+op64Ie0xSEd3zZ2WW2SYLQq6wvi8BM0DhVcKMyM+QBIuuzSH9lG6L2SpZtc7G/ q2WkigujxgRYzfYjKCmfKltiC+I2CWOHHpqeyaLe6ggPCup5Oq/L1zYrmlhD9rCF/OON yqRHzO6X1jV/4ZnLWdOSycqqvbIzAmgUYtxzMWEJT7icpSsxl7QTiXd2prNlwJjdgUhy 4og8YogEIAZdDh1ujaU5NdgbD4OPcQZnquMk1Zc76Qm1L7hbHjyobT9czF3U7Dkfv5rz tVbSwtvKmJ754HCBFmWNyOGApmARSYhITklHap544cTI6EFk3uHJxVSsWJebPdeDhpZe 4jKQ== 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; bh=ykNuYTs3vQADVQ7BqYp+potI3FMwH8+qeszIvIfF+1w=; b=nNfieniIaiZ8tBqe6BDEs8l/DSldudhQDyb9ZsSDj4s3+FtNLpRSG8vCIKrjBZKKQ+ He+kd9lAfb3lzXshuebanZX0JMPdUetmnCgpbyq+3DsiDFNL584bUBJMCMw19uf4urOQ mEW1MmoXYfY6W/QFyxJENH+5OZEk4JsyKk3RL1AJNuayCLypHgR1Kpe5WVH5A4aNjyjd eW5VJfw2wqtWSSeRkV5jAPnHuP1VfYlANTmXNTPEc4FHe/zKITkRbgUbN4ybGIcjpqyL UJeHB3OacigGc2Pv3TeJRIdXoc9ao+PL5I9pXuLsPrzNgPG5uVop0VpG7zB7qiKsqATH lu0w== X-Gm-Message-State: AElRT7Hfixb/pU2ZnkJbz+DLH1rO3WeD+PNeLjHb/PLhWtKqqOXSzmK+ 0kabNWX/j/ic+mzYGpdh51w= X-Google-Smtp-Source: AIpwx49ZZNTPLSmrSVNdzrGVjzNq7Cy3vuFAPBKm+SqbI+Ys5yn2ta6KvAAhyRVovtwPxwAV4V06ZQ== X-Received: by 10.98.214.91 with SMTP id r88mr12494616pfg.8.1522810667180; Tue, 03 Apr 2018 19:57:47 -0700 (PDT) Received: from localhost.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id a4sm8020701pfj.107.2018.04.03.19.57.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Apr 2018 19:57:46 -0700 (PDT) From: Jia He <hejianet@gmail.com> To: Russell King <linux@armlinux.org.uk>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Mark Rutland <mark.rutland@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@suse.com> Subject: [PATCH v6 5/5] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid() Date: Tue, 3 Apr 2018 19:56:19 -0700 Message-Id: <1522810579-7466-6-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522810579-7466-1-git-send-email-hejianet@gmail.com> References: <1522810579-7466-1-git-send-email-hejianet@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180403_195758_466320_5E5BC879 X-CRM114-Status: GOOD ( 16.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Gioh Kim <gi-oh.kim@profitbricks.com>, Wei Yang <richard.weiyang@gmail.com>, linux-mm@kvack.org, Eugeniu Rosca <erosca@de.adit-jv.com>, Petr Tesarik <ptesarik@suse.com>, Nikolay Borisov <nborisov@suse.com>, Jia He <hejianet@gmail.com>, Pavel Tatashin <pasha.tatashin@oracle.com>, Daniel Jordan <daniel.m.jordan@oracle.com>, AKASHI Takahiro <takahiro.akashi@linaro.org>, Vlastimil Babka <vbabka@suse.cz>, Andrey Ryabinin <aryabinin@virtuozzo.com>, Laura Abbott <labbott@redhat.com>, Daniel Vacek <neelx@redhat.com>, Mel Gorman <mgorman@suse.de>, Vladimir Murzin <vladimir.murzin@arm.com>, Kees Cook <keescook@chromium.org>, Philip Derrin <philip@cog.systems>, YASUAKI ISHIMATSU <yasu.isimatu@gmail.com>, Jia He <jia.he@hxt-semitech.com>, Kemi Wang <kemi.wang@intel.com>, linux-arm-kernel@lists.infradead.org, Steve Capper <steve.capper@arm.com>, linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>, Johannes Weiner <hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index a517d43..516ffb49 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1271,11 +1271,16 @@ static inline int pfn_present(unsigned long pfn) #define pfn_to_nid(pfn) (0) #endif -#define early_pfn_valid(pfn) pfn_valid(pfn) #ifdef CONFIG_HAVE_ARCH_PFN_VALID extern ulong memblock_next_valid_pfn(ulong pfn); #define next_valid_pfn(pfn) memblock_next_valid_pfn(pfn) -#endif + +extern int pfn_valid_region(ulong pfn); +#define early_pfn_valid(pfn) pfn_valid_region(pfn) +#else +#define early_pfn_valid(pfn) pfn_valid(pfn) +#endif /*CONFIG_HAVE_ARCH_PFN_VALID*/ + void sparse_init(void); #else #define sparse_init() do {} while (0)
Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns where possible") optimized the loop in memmap_init_zone(). But there is still some room for improvement. E.g. in early_pfn_valid(), if pfn and pfn+1 are in the same memblock region, we can record the last returned memblock region index and check check pfn++ is still in the same region. Currently it only improve the performance on arm64 and will have no impact on other arches. For the performance improvement, after this set, I can see the time overhead of memmap_init() is reduced from 41313 us to 24345 us in my armv8a server(QDF2400 with 96G memory). Signed-off-by: Jia He <jia.he@hxt-semitech.com> --- include/linux/mmzone.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)