Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp631971imm; Mon, 2 Jul 2018 19:13:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgperyiuSjND2zxfakmssp5Mud5ZQBVdMdvl3oho7XPt6hcSVQYObZHQXo+7L9IPOX/FOPn/I X-Received: by 2002:a65:5a49:: with SMTP id z9-v6mr14367257pgs.244.1530583987954; Mon, 02 Jul 2018 19:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530583987; cv=none; d=google.com; s=arc-20160816; b=m+x/pRqCk35GxmR+AlGexuflUcraKAJPsyCGVzpmG8hytB6jdzZ5G5MXbtXvXJtZH+ kni+yl3Ri/6p6ulZgGjhLAqlABcxd1VcrH5ZOOetT8nB29OQF3K6kN0OG1nGUkb6ovuf La5mE26DQh0S4OLmBmylhZO6nb/SAt2sXE/hIigxh1RHEAi6s7pwM/Wk5LApDCrCI37d +Wotngyf5FQJ+FAXHqWm23NtrrU01GZDjCYOdxNQDJA248wRDfEmhxUAVrvRpVgWdEpa bbVL8ft2Ipx/0oSVmt2h6XwQgMwBdPMxthx1ZLGYute9mIkV0oYlXHg6cwrlg9EIqsgX jNGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=nJUZscMeKQrggcqKta+WGqF6SYBZdjagsGq4adu1RW0=; b=ACmb1QmrNE0fe2049ELaA9gWbsZjswy3ZhVty6pwszMVbG8VxQhsEmgIYfzIkGIMb+ /w59b9ZmIRa8p86i5OOZaCF6xcXwXDEGN2+jMN2Zi2jLMLekuaIFH3YH7SC6ZExoCNxP NVRhlK+sjOJZecITr6eYEKRn/0Ht7Bh2v2xQVHUsQO1Bg6hTqfHjajLQh5HRXHYAsuRF A6e4dx2BWRYE89zEuszuY0GOXsZvBzY8bvU7MAMXEVTSXjRlCTSHAFToTLZf7BAK9qu+ E/7uzyltvJml8d2gRDgUpDjazLaBL3zgaEZSQ5mxUCcnUauEiFP80Ov+D+7eQsWIASwp xf1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mnMUzK3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18-v6si11585pge.117.2018.07.02.19.12.53; Mon, 02 Jul 2018 19:13:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mnMUzK3h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S932434AbeGCCLe (ORCPT + 99 others); Mon, 2 Jul 2018 22:11:34 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:40909 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932142AbeGCCLc (ORCPT ); Mon, 2 Jul 2018 22:11:32 -0400 Received: by mail-pg0-f68.google.com with SMTP id x5-v6so201814pgp.7 for ; Mon, 02 Jul 2018 19:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=nJUZscMeKQrggcqKta+WGqF6SYBZdjagsGq4adu1RW0=; b=mnMUzK3hF7EWIdifK0jSdFw2JZsrkLFb1lXcuYbajVO++pGRX7BBRNmT2WbxapsyXE RRNKuCxs5KOLBVimCKU0o7DzYmWDZVaaiod5UQhnzowittRAcLFjSY/Pce1Lqkv7AR7b 9+1xB+yMPsq7wGknhrboq0ktZgnKF5pQLJa+fgbCBvVDT0jFQCY6HIaGtSg9nwlrBCqY uhvlYikrW+7vM0PEWnUXADzaPyH8C6kELN0zyOp6DlNgV2oNzGOryil7lar/qqgUK3YP nyVlAP/eK6fOLAf7cXKn4ldXPQg6YtALKvB67AvhyoijnkxdAdW3jOXvPSoAXjM6dubs pWWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=nJUZscMeKQrggcqKta+WGqF6SYBZdjagsGq4adu1RW0=; b=iA44IGwMkkhSei3iKzXiNtAN272liIqsDOohb/tOsVqRV2fdeFztxa6BPA38WBmohy RlCqauH3eluXWNay7Ca0midZodk5nAl/ufz1KjJUHDRYfeoabPn18fsa8YMHbw1e9CCh i99298fP649MNsB0/j2MLJkONeg977Onn+0daBflcrjcs6TCJeuYWkfeIHKy1bPjfJqd XP3q1xTd/X6jJUyYWMBL7ZguYl/+Vl9oerf2nyQdzk1uFyvyGROWHAbt6DhwyfTkzU/n mw/xh46xaJSh0jlSYyNYuxFAcH4sHwod5p0SlUw0jaQK+UnWkV4FqxQjn2zNOq8m1UUV gdFg== X-Gm-Message-State: APt69E2Pmr63TGckma6TLoW3ekHHRGGdu//5Mi+AmkvSjP/3YP+Ke45h Oq2luPl5NPnEVMWZzWNkFro= X-Received: by 2002:a65:520d:: with SMTP id o13-v6mr12422443pgp.282.1530583891472; Mon, 02 Jul 2018 19:11:31 -0700 (PDT) Received: from [0.0.0.0] (65.49.234.56.16clouds.com. [65.49.234.56]) by smtp.gmail.com with ESMTPSA id j5-v6sm8855pfc.56.2018.07.02.19.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 19:11:30 -0700 (PDT) Subject: Re: [PATCH v9 0/6] optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64 To: Michal Hocko Cc: Russell King , Andrew Morton , Catalin Marinas , Mel Gorman , Will Deacon , Mark Rutland , "H. Peter Anvin" , Pavel Tatashin , Daniel Jordan , AKASHI Takahiro , Gioh Kim , Steven Sistare , Daniel Vacek , Eugeniu Rosca , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, James Morse , Ard Biesheuvel , Steve Capper , Thomas Gleixner , Ingo Molnar , Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , Johannes Weiner , Kemi Wang , Petr Tesarik , YASUAKI ISHIMATSU , Andrey Ryabinin , Nikolay Borisov , richard.weiyang@gmail.com References: <1530239363-2356-1-git-send-email-hejianet@gmail.com> <20180702114037.GJ19043@dhcp22.suse.cz> From: Jia He Message-ID: <779be6bf-db64-9175-f4c0-2baa0ea6defd@gmail.com> Date: Tue, 3 Jul 2018 10:11:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180702114037.GJ19043@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/2/2018 7:40 PM, Michal Hocko Wrote: > On Fri 29-06-18 10:29:17, Jia He wrote: >> Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns >> where possible") tried to optimize the loop in memmap_init_zone(). But >> there is still some room for improvement. > > It would be great to shortly describe those optimization from high level > POV. > >> >> Patch 1 introduce new config to make codes more generic >> Patch 2 remain the memblock_next_valid_pfn on arm and arm64 >> Patch 3 optimizes the memblock_next_valid_pfn() >> Patch 4~6 optimizes the early_pfn_valid() >> >> As for the performance improvement, after this set, I can see the time >> overhead of memmap_init() is reduced from 27956us to 13537us in my >> armv8a server(QDF2400 with 96G memory, pagesize 64k). > > So this is 13ms saving when booting 96G machine. Is this really worth > the additional code? Are there any other benefits? Sorry, Michal I missed one thing. This 13ms optimization is merely the result of my patch 3~6 Patch 1 is originated by Paul Burton in commit b92df1de5d289. In its description, === James said "I have tested this patch on a virtual model of a Samurai CPU with a sparse memory map. The kernel boot time drops from 109 to 62 seconds. " === -- Cheers, Jia > [...] >> arch/arm/Kconfig | 4 +++ >> arch/arm/mm/init.c | 1 + >> arch/arm64/Kconfig | 4 +++ >> arch/arm64/mm/init.c | 1 + >> include/linux/early_pfn.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++ >> include/linux/memblock.h | 2 ++ >> include/linux/mmzone.h | 18 ++++++++++- >> mm/Kconfig | 3 ++ >> mm/memblock.c | 9 ++++++ >> mm/page_alloc.c | 5 ++- >> 10 files changed, 124 insertions(+), 2 deletions(-) >> create mode 100644 include/linux/early_pfn.h >