Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3300559imj; Mon, 11 Feb 2019 18:13:24 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia2OADd3l8Okj74kD9u5wwV2LPoXX8aqeP2E2UjfsJb5DjIpXzLFp+A4pLl7m8BgzA0xa9p X-Received: by 2002:a63:eb02:: with SMTP id t2mr1377988pgh.57.1549937604659; Mon, 11 Feb 2019 18:13:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549937604; cv=none; d=google.com; s=arc-20160816; b=rmCi49QIv58imd2Q5kwzth9YJRAnebWgBHw2Fgjh1C7AXq5vaRC6f22Ollx4WfmgVY 0Hl7LPgu9yju/835fsiqBJuRSjKrGtVVgkDpxO21yoAbqw+oo4s/qbDnQYNSgBCBPqM5 NLFfqL/QnehbHnXMu4PzETzQwSHMyVEuvNI7yBXONQuTv4qAEgJS1cCXo7onLjSEdLyi wvee+VGDoSuaHgYkNeR8Ktg9EBQyP/KsMkYGe7NnxXfNvUHaHi8HbBFSJ3MuLDsuHUVB BQq92NmcdbA+2DWx4DyzpgBHEhyI2Ovk1pP81D3FAQfFCpB2YQ3lvDzYR6bH5+bdsbFi s8Sw== 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:mime-version :message-id:date:subject:cc:to:from; bh=LF0ZcIQz8RjfvxB88Wfb/M8/rN209zzeAjWgjfUr8RI=; b=UkzVYPL/1mN201UUrp9/78f7VaYAN+9Onw//G296m2D+EgZHKeAmEuUcYufqke7RZP S2+ncvA87OQ+ieGos9dtSdzshA0H1COP6Kg1e2s5PN9JH7ECC4Qw9+VIkZ7l88l5ZsyG IVSTwOKA0JopT0qlpixaynZK42AQtetNB4B3s/DyQpyF4CViPNkg7K0iCDYWc9Ex0PaX 9bhGT9gYcmA/N4J7rd91/jfeB1LoUlunXB5NmBwKlUxmYP1uvG1BoRafCDEc8LkynrnM xkigIFztSF6+DuX9/NgV/ZKj3xd9fEUy2Kl6H2+H6++G03dW/CwhdpgWd7c/EWhVjV6Y IdiA== 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 a24si6003125plm.71.2019.02.11.18.13.09; Mon, 11 Feb 2019 18:13:24 -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 S1727660AbfBLCMv (ORCPT + 99 others); Mon, 11 Feb 2019 21:12:51 -0500 Received: from mga02.intel.com ([134.134.136.20]:63677 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726699AbfBLCMv (ORCPT ); Mon, 11 Feb 2019 21:12:51 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2019 18:12:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,361,1544515200"; d="scan'208";a="142618119" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 11 Feb 2019 18:12:48 -0800 From: Wei Yang To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.or, tglx@linutronix.de, Wei Yang Subject: [PATCH 0/6] x86, mm: refine split_mem_range a little Date: Tue, 12 Feb 2019 10:12:09 +0800 Message-Id: <20190212021215.13247-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Here are some patches to refine it. Patch [1-2] are trivial clean up. Patch [3] add some comment to illustrate the split process and prepare for following refine work. Patch [4-6] are the interesting refine. There are totally 3 kinds of ranges, while 1G range is only valid on x86_64. Because of this, the code needs to handle two different configurations. The conditional macro makes it a little difficult to understand the logic. We could simplify the logic with a different perception of those ranges, this is done in Patch [4]. The change is a little, while the result is neat and clean. After this, the refreshed code shows we could skip some redundant work when the range doesn't span PMD or PUD. This is in Patch [4-5]. Wei Yang (6): x86, mm: remove second argument of split_mem_range() x86, mm: remove check in save_mr x86, mm: add comment for split_mem_range to help understanding x86, mm: make split_mem_range() more easy to read x86, mm: skip 1G range if the range doesn't span PUD x86, mm: x86, mm: jump to split only 4K range when range doesn't span PMD arch/x86/mm/init.c | 87 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 26 deletions(-) -- 2.19.1