Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1383328imm; Tue, 3 Jul 2018 10:08:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwUxeimgyZQ0pEb8j4KUwPPiCPvORQ4pMoLBY40k1RXoAy5+Y3ihA5OguWcPpC9kyb2y3N X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr26688807pfo.82.1530637711436; Tue, 03 Jul 2018 10:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530637711; cv=none; d=google.com; s=arc-20160816; b=xbmEUZ+jpJiZUhc9Hmxu967VuwRFar+98OR25ziH4G1qZu96IaUVsalOzoVwimgkp7 Qg8UfOMdbmWgKOHbW6fidlu3XY7f3OG6nl8NSJriRXRG/2CJ++k7AkaUl+QObsq8p7n+ u6gTCiJPM0cRmuTEqDGpsqjiMCzsP+/jPK4vhcJAAZTCMB+mElud7qBtmYCuFZ63R4tT Gd11b8aMxGj7XxWk+iGxbkysUjBlxN69xTyFzYQeJOBmbE3W2H2MFxEGMsruu2NQtrT/ ydiIEgICb9XG5kKS/5AhlQeyJYoD3OAm+fLHyTP/7BuNwJMk+JCd+yb7OB0/G6ToozLQ n1wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tZ9et+VQPA7JNkGsgg1U7+yqcWgwSa4PyF6j1zlPrTE=; b=NgrrRISKZz5LlHggY3mid3H8sMydxd9YLW2JajHCz2qx95EBisSB4FIhIlz4e+PeeC 6DrodrXY6SPJljLPOcwh2oaPUhCWVsC3ik3lga2U1ejSV7YEvQLsJO0YhJoLspnbmDpy Ird+1s0Nh7uLcZX8kAU/icB3ecU+EIaYFHuNN/JawE2W7gxWyeJfkihE208ku8e1wgju wjIu/I6K0gKe2xyWPBLMMv+gI7fBFsQVtvy+YztvDxgDHuv3KlpEE5G/xk11NgoRxhmm OixTBNNIXU9j7mnyqFrF91RVvu2JL0uFv0iQVcWU1dN+lM3MPS+8zZJy7ozpaNEmULls qd7g== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si1467432plk.299.2018.07.03.10.08.16; Tue, 03 Jul 2018 10:08:31 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934036AbeGCRFS (ORCPT + 99 others); Tue, 3 Jul 2018 13:05:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36524 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932559AbeGCRFR (ORCPT ); Tue, 3 Jul 2018 13:05:17 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w63H3jKv054425 for ; Tue, 3 Jul 2018 13:05:17 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k0a9jrdjn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 03 Jul 2018 13:05:16 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Jul 2018 18:05:14 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 3 Jul 2018 18:05:11 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w63H5AQB44105894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 3 Jul 2018 17:05:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6006AE056; Tue, 3 Jul 2018 20:05:12 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 43D1BAE051; Tue, 3 Jul 2018 20:05:11 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.206.209]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 3 Jul 2018 20:05:11 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Tue, 03 Jul 2018 20:05:07 +0300 From: Mike Rapoport To: Andrew Morton Cc: linux-mm , lkml , Mike Rapoport , Michal Hocko , Matthew Wilcox Subject: [PATCH] mm/memblock: replace u64 with phys_addr_t where appropriate Date: Tue, 3 Jul 2018 20:05:06 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18070317-0012-0000-0000-000002865FCD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18070317-0013-0000-0000-000020B7DD86 Message-Id: <1530637506-1256-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-03_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=583 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807030194 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); /* * 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