From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752307AbbCYLty (ORCPT ); Wed, 25 Mar 2015 07:49:54 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48022 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbCYLtv (ORCPT ); Wed, 25 Mar 2015 07:49:51 -0400 Date: Wed, 25 Mar 2015 11:49:45 +0000 From: Mel Gorman To: Gregory Fong Cc: Russell King - ARM Linux , Laura Abbott , Florian Fainelli , Kees Cook , Nicolas Pitre , Catalin Marinas , open list , Yalin Wang , "linux-arm-kernel@lists.infradead.org" , vishnu.ps@samsung.com, Marek Szyprowski , Johannes Weiner Subject: Re: [PATCH] ARM: print cma-reserved pages from show_mem Message-ID: <20150325114945.GK4701@suse.de> References: <1423092164-9145-1-git-send-email-gregory.0xf0@gmail.com> <54D40DAF.4080609@codeaurora.org> <54D534FB.1090101@codeaurora.org> <20150210113230.GJ8656@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 23, 2015 at 02:08:12AM -0700, Gregory Fong wrote: > Hello, > > On Tue, Feb 10, 2015 at 3:32 AM, Russell King - ARM Linux > wrote: > > On Mon, Feb 09, 2015 at 11:55:54AM -0800, Gregory Fong wrote: > >> On Fri, Feb 6, 2015 at 1:41 PM, Laura Abbott wrote: > >> > So it looks like the lib/show_mem.c does something different > >> > #ifdef CONFIG_CMA > >> > printk("%lu pages reserved\n", (reserved - totalcma_pages)); > >> > printk("%lu pages cma reserved\n", totalcma_pages); > >> > #else > >> > printk("%lu pages reserved\n", reserved); > >> > #endif > >> > > >> > > >> > No need to change the name, instead I'd say fix up arm to match what > >> > the generic showmem is doing. > >> > >> The trouble is that lib/show_mem.c and ARM's show_mem use the > >> 'reserved' variable to hold different info, which was not a problem I > >> was aiming to tackle here, and am not sure I understand what's going > >> on well enough to do so. But let's give it a shot: > >> > >> In lib/show_mem.c, reserved is calculated by iterating over all online > >> nodes, then increasing reserved by (zone->present_pages - > >> zone->managed_pages). This count includes CMA pages and so when > >> reserved pages is printed it should be 'reserved' - totalcma_pages, as > >> it currently is. > > > > So, some digging is needed into why the generic version is different. > > You have to remember that many of the algorithms for this kind of thing > > were based on the x86 implementation, so differences like this are > > probably down to ARM being annoyingly overlooked or ignored when generic > > changes happen. > > > > Revisiting this finally, it looks like this was changed by Mel about a > year and a half ago in commit c78e93630d15b5f5774213aad9bdc9f52473a89b > "mm: do not walk all of system memory during show_mem"[1], which > removes the pfn walk and gets this info from struct zone instead, > saving a lot of time. Is there any reason to not to change the ARM > show_mem to do this as well? I did not read through this thread and only see this mail but AFAIK, the same change should be safe on ARM. I simply had no means of testing ARM changes and the problem only affected large machines. For all I knew, ARM developers really cared about the accuracy of this information so I played it safe. -- Mel Gorman SUSE Labs