From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934201AbcAKREg (ORCPT ); Mon, 11 Jan 2016 12:04:36 -0500 Received: from arcturus.aphlor.org ([188.246.204.175]:34216 "EHLO arcturus.aphlor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933658AbcAKREe (ORCPT ); Mon, 11 Jan 2016 12:04:34 -0500 Date: Mon, 11 Jan 2016 12:04:28 -0500 From: Dave Jones To: x86@kernel.org Cc: Linux Kernel Subject: [x86] Make split_page_count check for empty levels. Message-ID: <20160111170428.GA8547@codemonkey.org.uk> Mail-Followup-To: Dave Jones , x86@kernel.org, Linux Kernel MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Score: -2.9 (--) X-Spam-Report: Spam detection software, running on the system "arcturus.aphlor.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In PAGEALLOC_DEBUG builds, we disable the 2M pages. Unfortunatly when we split up mappings during boot, split_page_count doesn't take this into account, and starts decrementing an empty direct_pages_count level. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In PAGEALLOC_DEBUG builds, we disable the 2M pages. Unfortunatly when we split up mappings during boot, split_page_count doesn't take this into account, and starts decrementing an empty direct_pages_count level. This results in /proc/meminfo showing crazy things like DirectMap2M: 18446744073709543424 kB Signed-off-by: Dave Jones diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index a3137a4feed1..ff0e0c6c350e 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -66,6 +66,9 @@ void update_page_count(int level, unsigned long pages) static void split_page_count(int level) { + if (direct_pages_count[level] == 0) + return; + direct_pages_count[level]--; direct_pages_count[level - 1] += PTRS_PER_PTE; }