Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1154510ybl; Wed, 4 Dec 2019 18:17:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzCqf97z6XsGFotBMcE/Ih6+wejugVM4VJHtU5ntVL9CwthhEz6Da9+1UCJ/ZMcAkQGBWby X-Received: by 2002:aca:4106:: with SMTP id o6mr5428160oia.173.1575512240265; Wed, 04 Dec 2019 18:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575512240; cv=none; d=google.com; s=arc-20160816; b=dRQigcd2J147c9YKh7wepvqN8thYSTPZu0aKEiZ0FLo+uTg5a0UnvOiGQoBLPPeYMm N22qmScHRvmJacp+5IQFmKH+l+hzKDkh/O7bFPQIxuau9czHPkl7qR5H6gLEs/rgJSOh AH6DEIhJtDXBFfZnFv2fZjdsqL2FDmr/kK2Z6MYc7rX9FrNP+4VyFOL/r0zf5YRkY6Jo 9HxIlzmlYWej63HKW7na57L4x1odVAVRD9LIEHgR1vm8Yz0ROBvMHz2fycogy8rwP6qb VeZQOFxZZp55LimVmSbzeG52xNfH07rMP/jBO3WFiSl/C8wEOzbjSNrpM83uh4vSfUi2 4sxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Reum7Napz7gf8n3E2es/x6MO48DMLxzc5LhQ/V8FXLY=; b=Ks8I3Ol+HYWcSDgI/AdU/YFG6MwsnWyvqqqEs7o6XFrSOmqixdeM23LnO+L/AdD5HA 4s72fOSxPl3ACgrp5FMhgaO2c+yaEgUM8uvz3YJrTueCnFLTW+fM5gddKtHQnVHVxufK MYKvKQPMtSzmb1yCZseDtbmwQem8tMCCdMUpvBaU+V86TGB0jxwncv262MQM5xmcBaI1 Ojs94JpO4LthbRmzJ4ijcSDEXmKVEiwqW34eFcQhIALEtJZvKPmtXyo3/f9fS8AKfr3p SHBKVYMNAvG/DqGG1rNl6UmjHxpX/luyknADHpb+ywQLTGMo4R6IxH1eK/n0LMiI1A2p wuQQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si4061515oti.56.2019.12.04.18.17.08; Wed, 04 Dec 2019 18:17:20 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728611AbfLECPl (ORCPT + 99 others); Wed, 4 Dec 2019 21:15:41 -0500 Received: from mga17.intel.com ([192.55.52.151]:28117 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728121AbfLECPl (ORCPT ); Wed, 4 Dec 2019 21:15:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 18:15:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,279,1571727600"; d="scan'208";a="219080343" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga001.fm.intel.com with ESMTP; 04 Dec 2019 18:15:37 -0800 From: Wei Yang To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: richard.weiyang@gmail.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.or, tglx@linutronix.de, Wei Yang Subject: [Patch v2 0/6] Refactor split_mem_range with proper helper and loop Date: Thu, 5 Dec 2019 10:13:57 +0800 Message-Id: <20191205021403.25606-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org split_mem_range is used to prepare range before mapping kernel page table. After first version, Thomas suggested some brilliant idea to re-write the logic. Wei split the big patch into pieces and did some tests. To verify the functionality, Wei abstract the code into userland and did following test cases: * ranges fits only 4K * ranges fits only 2M * ranges fits only 1G * ranges fits 4K and 2M * ranges fits 2M and 1G * ranges fits 4K, 2M and 1G * ranges fits 4K, 2M and 1G but w/o 1G size * ranges fits 4K, 2M and 1G with only 4K size Below is the test result: ### Split [4K, 16K][0x00001000-0x00004000]: [mem 0x00001000-0x00003fff] page size 4K ### Split [4M, 64M][0x00400000-0x04000000]: [mem 0x00400000-0x03ffffff] page size 2M ### Split [0G, 2G][0000000000-0x80000000]: [mem 0000000000-0x7fffffff] page size 1G ### Split [16K, 4M + 16K][0x00004000-0x00404000]: [mem 0x00004000-0x001fffff] page size 4K [mem 0x00200000-0x003fffff] page size 2M [mem 0x00400000-0x00403fff] page size 4K ### Split [4M, 2G + 2M][0x00400000-0x80200000]: [mem 0x00400000-0x3fffffff] page size 2M [mem 0x40000000-0x7fffffff] page size 1G [mem 0x80000000-0x801fffff] page size 2M ### Split [4M - 16K, 2G + 2M + 16K][0x003fc000-0x80204000]: [mem 0x003fc000-0x003fffff] page size 4K [mem 0x00400000-0x3fffffff] page size 2M [mem 0x40000000-0x7fffffff] page size 1G [mem 0x80000000-0x801fffff] page size 2M [mem 0x80200000-0x80203fff] page size 4K ### Split w/o 1G size [4M - 16K, 2G + 2M + 16K][0x003fc000-0x80204000]: [mem 0x003fc000-0x003fffff] page size 4K [mem 0x00400000-0x801fffff] page size 2M [mem 0x80200000-0x80203fff] page size 4K ### Split w/ only 4K [4M - 16K, 2G + 2M + 16K][0x003fc000-0x80204000]: [mem 0x003fc000-0x80203fff] page size 4K Thomas Gleixner (1): x86/mm: Refactor split_mem_range with proper helper and loop Wei Yang (5): x86/mm: Remove second argument of split_mem_range() x86/mm: Add attribute __ro_after_init to after_bootmem x86/mm: Make page_size_mask unsigned int clearly x86/mm: Refine debug print string retrieval function x86/mm: Use address directly in split_mem_range() arch/x86/mm/init.c | 259 ++++++++++++++++++--------------------------- 1 file changed, 103 insertions(+), 156 deletions(-) -- 2.17.1