Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp815896imm; Wed, 4 Jul 2018 06:31:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpduvnee0CgXnoQ9VgHhH0W6JAeX+Um8ybBbj0I4UZiwSvMd60S1dml9oGs2SaNJrcXEioOW X-Received: by 2002:a62:121a:: with SMTP id a26-v6mr2243217pfj.104.1530711077643; Wed, 04 Jul 2018 06:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530711077; cv=none; d=google.com; s=arc-20160816; b=AAqPQzHTzyc0S/IAXbImCX8cuJFfPdKEW4+p+fMttLJWpHecnjSrq8eD6xjiyPc77h JSyRohvDpPK1MAfsdUcj/GHlwED9XrbN0rf3Dc5USglsSYEp5NIDFTaB54WNquW7r6Ee iH26ZSJu5cu+XIwzszqzPycNg325m1j48u0Qt0ucEGUexWcHiqyvT183v/B3ha/nx8Qn 6begpJ6c+0pq0JPxL4tN5+49tvZMOmBTEWC5kvMrNCSnqzAR8j34OOHV/UP3BAUC92aK wKx+EHMEXuxQ5eGpa6GZiA4c3M2/ugm77/GfIt1xEtwImfk8OlRw3q6cc53bVMDipSOf qtlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=PwBWVRCXVN+8R2yqiU+Qq/gutzBBkWhi18J7XK88wrk=; b=jDWfHWjZmcfUtp10t20lGRn+ZVTDbXr3Ij68ERfWFgVSJkje20tjZkb6zZaMDD2kSQ QDL2NH1ILYK35RywYiQ8Cr2blVYhpBZFnvWbn3sbV8qVE6wx2necyboxVHSWasgss0bJ ki5GOpoNwzfPkX15+TtqSvoeflHrL5lXEunqXQddVN/fmszhsDavcPMnC6vme0Rn7r1Z 8UGIUvlGyCRQ2uKmcdzPZ/e4Olt/6LNQPRu288Zv3f1EFGNzOf3tZ+lBLu/ycwJLXkdD E5GB8nMD85Uo+LiPjD68VmWDXCgw+HdPIVF7es0fcCOgu51AsZwaF0FfwDU1XgorfDyV AQig== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i126-v6si3662544pfc.296.2018.07.04.06.31.02; Wed, 04 Jul 2018 06:31:17 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbeGDN3I (ORCPT + 99 others); Wed, 4 Jul 2018 09:29:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:55638 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752712AbeGDN3H (ORCPT ); Wed, 4 Jul 2018 09:29:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CA6A5AD89; Wed, 4 Jul 2018 13:29:05 +0000 (UTC) Date: Wed, 4 Jul 2018 15:29:05 +0200 From: Michal Hocko To: Mike Rapoport Cc: Andrew Morton , linux-mm , lkml , Matthew Wilcox Subject: Re: [PATCH] mm/memblock: replace u64 with phys_addr_t where appropriate Message-ID: <20180704132905.GS22503@dhcp22.suse.cz> References: <1530637506-1256-1-git-send-email-rppt@linux.vnet.ibm.com> <20180704130500.GP22503@dhcp22.suse.cz> <20180704132410.GH4352@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180704132410.GH4352@rapoport-lnx> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 04-07-18 16:24:11, Mike Rapoport wrote: > On Wed, Jul 04, 2018 at 03:05:00PM +0200, Michal Hocko wrote: > > On Tue 03-07-18 20:05:06, Mike Rapoport wrote: > > > Most functions in memblock already use phys_addr_t to represent a physical > > > address with __memblock_free_late() being an exception. > > > > > > This patch replaces u64 with phys_addr_t in __memblock_free_late() and > > > switches several format strings from %llx to %pa to avoid casting from > > > phys_addr_t to u64. > > > > > > CC: Michal Hocko > > > CC: Matthew Wilcox > > > Signed-off-by: Mike Rapoport > > > --- > > > mm/memblock.c | 46 +++++++++++++++++++++++----------------------- > > > 1 file changed, 23 insertions(+), 23 deletions(-) > > > > > > diff --git a/mm/memblock.c b/mm/memblock.c > > > index 03d48d8..20ad8e9 100644 > > > --- a/mm/memblock.c > > > +++ b/mm/memblock.c > > > @@ -330,7 +330,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, > > > { > > > struct memblock_region *new_array, *old_array; > > > phys_addr_t old_alloc_size, new_alloc_size; > > > - phys_addr_t old_size, new_size, addr; > > > + phys_addr_t old_size, new_size, addr, new_end; > > > int use_slab = slab_is_available(); > > > int *in_slab; > > > > > > @@ -391,9 +391,9 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, > > > return -1; > > > } > > > > > > - memblock_dbg("memblock: %s is doubled to %ld at [%#010llx-%#010llx]", > > > - type->name, type->max * 2, (u64)addr, > > > - (u64)addr + new_size - 1); > > > + new_end = addr + new_size - 1; > > > + memblock_dbg("memblock: %s is doubled to %ld at [%pa-%pa]", > > > + type->name, type->max * 2, &addr, &new_end); > > > > I didn't get to check this carefully but this surely looks suspicious. I > > am pretty sure you wanted to print the value here rather than address of > > the local variable, right? > > It's the semantics of %pa: > > Physical address types phys_addr_t > ---------------------------------- > > :: > > %pa[p] 0x01234567 or 0x0123456789abcdef > > For printing a phys_addr_t type (and its derivatives, such as > resource_size_t) which can vary based on build options, regardless of the > width of the CPU data path. > > Passed by reference. I wasn't aware of that. Thanks for the clarification! -- Michal Hocko SUSE Labs