Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp852454imm; Wed, 4 Jul 2018 07:06:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe30VgjcBtIZ9Jo9Cshh724oEWBvAzrBmQCtcjmqr99pyA3Ochtm8O7qqSoHygxvT7wG1XS X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr2311987plb.226.1530713218197; Wed, 04 Jul 2018 07:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530713218; cv=none; d=google.com; s=arc-20160816; b=rvFXCw8uKl3S3A1L3fVmi+gzG10RUtwzhHBWc/WQisUEEOrNASENmW8S7vRlmaBLMV lGsWw5AvRKHyT0LK0fPZrrPteKAXe3Ybo6riCVZDh55E6Akfcprgjqqv2g2gHLpx8w/7 V6KEzFxBhqq6M73c8j7M3j6Ksj06CqyGX4RRrKb6QSCi4r0KBUBF0cqu9JcHoD7Q0wmG 8q86TjcnwmBZ75uPaDpRQ3MAnEWr/Eq0gbKN2etCk5npz7LJkNbRgn9yA06QkqKORMR9 Ygv7aNyAn6+yhffTdTmuxckiQY9EpaM9fYir8a3IX1obqdZmF+xtyB3epfNju0qdN54I gqqQ== 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=XyT2aLQBBiqtZy422DOm9zUZOCSrs8ywze91x5SEUHQ=; b=f/4GLHpwlNAls9xxvbH8lHndByRRvRe3PI2K7ByK5+RzQrwnq1vRzNCvxtuUabI+U/ oyOumURYi3zhSi6YwBlSJU3mlVI3SLFAbJ0+N+E5IfTS5P7s+A8YyoA7/FDUvPpXwCTZ f2LbBkqfywzAWaKIfEeKvMD1pDoUDmORrS/sFDTHNfXOe+YE73IM2xe/ZpnS+LW00pNr 16aJvLOnM1fgIzRBvgfb7fq+e6u7Cf3PLWjKRmoqd7xmcnJGWtFHGdWcnA5CzAL6VsCy FmiDTf+V6eLunz75veZQn4iRf+BiGElUs07wDLSvX+6ljeeTvqk9PpFo15wQElRMlO0i D5dw== 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 r6-v6si3267332pgp.426.2018.07.04.07.06.28; Wed, 04 Jul 2018 07:06:58 -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 S1752578AbeGDOEW (ORCPT + 99 others); Wed, 4 Jul 2018 10:04:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:34244 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751761AbeGDOEV (ORCPT ); Wed, 4 Jul 2018 10:04:21 -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 23637AE60; Wed, 4 Jul 2018 14:04:20 +0000 (UTC) Date: Wed, 4 Jul 2018 16:04:19 +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: <20180704140419.GU22503@dhcp22.suse.cz> References: <1530637506-1256-1-git-send-email-rppt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1530637506-1256-1-git-send-email-rppt@linux.vnet.ibm.com> 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 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 Acked-by: Michal Hocko > --- > 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); > > /* > * Found space, we now need to move the array over before we add the > @@ -1343,9 +1343,9 @@ void * __init memblock_virt_alloc_try_nid_raw( > { > void *ptr; > > - memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", > - __func__, (u64)size, (u64)align, nid, (u64)min_addr, > - (u64)max_addr, (void *)_RET_IP_); > + memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n", > + __func__, (u64)size, (u64)align, nid, &min_addr, > + &max_addr, (void *)_RET_IP_); > > ptr = memblock_virt_alloc_internal(size, align, > min_addr, max_addr, nid); > @@ -1380,9 +1380,9 @@ void * __init memblock_virt_alloc_try_nid_nopanic( > { > void *ptr; > > - memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", > - __func__, (u64)size, (u64)align, nid, (u64)min_addr, > - (u64)max_addr, (void *)_RET_IP_); > + memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n", > + __func__, (u64)size, (u64)align, nid, &min_addr, > + &max_addr, (void *)_RET_IP_); > > ptr = memblock_virt_alloc_internal(size, align, > min_addr, max_addr, nid); > @@ -1416,9 +1416,9 @@ void * __init memblock_virt_alloc_try_nid( > { > void *ptr; > > - memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", > - __func__, (u64)size, (u64)align, nid, (u64)min_addr, > - (u64)max_addr, (void *)_RET_IP_); > + memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n", > + __func__, (u64)size, (u64)align, nid, &min_addr, > + &max_addr, (void *)_RET_IP_); > ptr = memblock_virt_alloc_internal(size, align, > min_addr, max_addr, nid); > if (ptr) { > @@ -1426,9 +1426,8 @@ void * __init memblock_virt_alloc_try_nid( > return ptr; > } > > - panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx\n", > - __func__, (u64)size, (u64)align, nid, (u64)min_addr, > - (u64)max_addr); > + panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa\n", > + __func__, (u64)size, (u64)align, nid, &min_addr, &max_addr); > return NULL; > } > > @@ -1442,9 +1441,10 @@ void * __init memblock_virt_alloc_try_nid( > */ > void __init __memblock_free_early(phys_addr_t base, phys_addr_t size) > { > - memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", > - __func__, (u64)base, (u64)base + size - 1, > - (void *)_RET_IP_); > + phys_addr_t end = base + size - 1; > + > + memblock_dbg("%s: [%pa-%pa] %pF\n", > + __func__, &base, &end, (void *)_RET_IP_); > kmemleak_free_part_phys(base, size); > memblock_remove_range(&memblock.reserved, base, size); > } > @@ -1460,11 +1460,11 @@ void __init __memblock_free_early(phys_addr_t base, phys_addr_t size) > */ > void __init __memblock_free_late(phys_addr_t base, phys_addr_t size) > { > - u64 cursor, end; > + phys_addr_t cursor, end; > > - memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", > - __func__, (u64)base, (u64)base + size - 1, > - (void *)_RET_IP_); > + end = base + size - 1; > + memblock_dbg("%s: [%pa-%pa] %pF\n", > + __func__, &base, &end, (void *)_RET_IP_); > kmemleak_free_part_phys(base, size); > cursor = PFN_UP(base); > end = PFN_DOWN(base + size); > -- > 2.7.4 -- Michal Hocko SUSE Labs