Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6119793pxu; Wed, 23 Dec 2020 14:14:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsr3FKbojB88kAOzZPt9gmZQmiNXFFBYaA2mV8uVWahKVwxJhQUJDXBOqUSSDgQxgCCwzu X-Received: by 2002:a05:6402:1646:: with SMTP id s6mr26390914edx.319.1608761643225; Wed, 23 Dec 2020 14:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608761643; cv=none; d=google.com; s=arc-20160816; b=vOmHhafS5AxY3pOG1B90ZVOEr51jaZLayAy1knPtePeddXg+2P2s8/s33AQ4H4msKa 5qRRd4EBpjvaFRD79gCpbMo8Q6GiVPrtO87PsyTKj15U13gDB8Y9XvOPICRADAvF9AxM /v04RPoxxIHamISIIKba1LgNAeicYubu8ChHlvJ4cReSi5h4WvnA+xYiwPj8OMoldCzM IwY0pr/Jpm062QWOvhlNXfhsUlLcpq6fPyW2d49oHe3mWG9BIGpFSzpjG54x2xg5xDBK CiB/6nDQ51Q8UL8fcu8bQfmnz1p7CdXZpXZzPhNHiOs6HDJUAPEp4qhvTr0vHsfn6n1e Fktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=loy7IBIDjBn8XHNDf8aWDmqfDOAoMi4OJDPMVUy+YVE=; b=M6CbBm1SMCwW+PKeru1P5pMZfaBLjdTmD/W2iw5WJX4nX46ohGqKB9JtgAm4V9RfGi P70kl7+IxJ+SIJ7ZcRboLwOEuFNqee+vWaDsQt3KcoysRS4lQOYmXoiSIsrBHhX25dpt n5I9AJCUcW4Ev/QJEWgYPeoSNfrKmtDpaybTdEAj+IxcO8ZBaQDVVUh1S6A45dmbt5Lk i7t6AE0tWjqcvqvH0NDn9niHISQKe+/w40wH+dhSRaBwP4bchS0i7scR+/C0+YXkrsKR AXt0x7azP1gRvNKtgG0ger3dNZz0vu/uOdIgpr82wSVY9A1nwRip10tUtuSNZwm7duVV 9BIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WGWyz95x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs4si14541320edb.555.2020.12.23.14.13.40; Wed, 23 Dec 2020 14:14:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WGWyz95x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbgLWWL2 (ORCPT + 99 others); Wed, 23 Dec 2020 17:11:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:56278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbgLWWL2 (ORCPT ); Wed, 23 Dec 2020 17:11:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8353222202; Wed, 23 Dec 2020 22:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608761447; bh=bC4arC7kCsqpAI2Kec7Pwm949X5SiBOT2DcjnCTGTHA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WGWyz95x9D5GpEGsWUSwuSBB4YjS0CuTyDRhnhPPw6mjJL/6lXRsVZ48PQqgZY+F4 n9rYfqc0Gn53kvczMG5ug4VJivqLGV7hxZA2CRdHMCAS/8Y2U0yFIkUgzJTXY9EvLz E6YirwPUdTVj/33KvFNEv03PBI3Qbjh1L4KmKvWqnXPPq2P2bqA1YVWwaBjxLdAk4n 5XPUz+g277LddH759VU7P55Acv35YBUoHiqyKk2t4c1XwO0vvMS8ElXpuixAq3Cs+c uB1xkce/fhHWuqAUE8HymjrzcOsgoCiUMUG6pUbkWM/T7l+iIZAllm6UsoMj+Q7okU p5Xa6JxDZYTZg== Date: Thu, 24 Dec 2020 00:10:39 +0200 From: Mike Rapoport To: Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, Joonsoo Kim , Rik van Riel , Michal Hocko , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH v2 1/2] mm: cma: allocate cma areas bottom-up Message-ID: <20201223221039.GH392325@kernel.org> References: <20201217201214.3414100-1-guro@fb.com> <20201220064848.GA392325@kernel.org> <20201221170551.GB3428478@carbon.DHCP.thefacebook.com> <20201222200606.fe4444f1f0ba008ee9fda091@linux-foundation.org> <20201223163537.GA4011967@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201223163537.GA4011967@carbon.DHCP.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 23, 2020 at 08:35:37AM -0800, Roman Gushchin wrote: > On Tue, Dec 22, 2020 at 08:06:06PM -0800, Andrew Morton wrote: > > On Mon, 21 Dec 2020 09:05:51 -0800 Roman Gushchin wrote: > > > > > Subject: [PATCH v3 1/2] mm: cma: allocate cma areas bottom-up > > > > i386 allmodconfig: > > > > In file included from ./include/vdso/const.h:5, > > from ./include/linux/const.h:4, > > from ./include/linux/bits.h:5, > > from ./include/linux/bitops.h:6, > > from ./include/linux/kernel.h:11, > > from ./include/asm-generic/bug.h:20, > > from ./arch/x86/include/asm/bug.h:93, > > from ./include/linux/bug.h:5, > > from ./include/linux/mmdebug.h:5, > > from ./include/linux/mm.h:9, > > from ./include/linux/memblock.h:13, > > from mm/cma.c:24: > > mm/cma.c: In function ‘cma_declare_contiguous_nid’: > > ./include/uapi/linux/const.h:20:19: warning: conversion from ‘long long unsigned int’ to ‘phys_addr_t’ {aka ‘unsigned int’} changes value from ‘4294967296’ to ‘0’ [-Woverflow] > > #define __AC(X,Y) (X##Y) > > ^~~~~~ > > ./include/uapi/linux/const.h:21:18: note: in expansion of macro ‘__AC’ > > #define _AC(X,Y) __AC(X,Y) > > ^~~~ > > ./include/linux/sizes.h:46:18: note: in expansion of macro ‘_AC’ > > #define SZ_4G _AC(0x100000000, ULL) > > ^~~ > > mm/cma.c:349:53: note: in expansion of macro ‘SZ_4G’ > > addr = memblock_alloc_range_nid(size, alignment, SZ_4G, > > ^~~~~ > > > > I thought that (!memblock_bottom_up() && memblock_end >= SZ_4G + size) > can't be true on a 32-bit platform, so the whole if clause can be compiled out. > Maybe it's because memblock_end can be equal to SZ_4G and if the size == 0... > > I have no better idea than wrapping everything into > #if BITS_PER_LONG > 32 > #endif. 32-bit systems can have more than 32 bit in the physical address. I think a better option would be to use CONFIG_PHYS_ADDR_T_64BIT > Thanks! > > -- > > diff --git a/mm/cma.c b/mm/cma.c > index 4fe74c9d83b0..5d69b498603a 100644 > --- a/mm/cma.c > +++ b/mm/cma.c > @@ -344,12 +344,14 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, > * Avoid using first 4GB to not interfere with constrained zones > * like DMA/DMA32. > */ > +#if BITS_PER_LONG > 32 > if (!memblock_bottom_up() && memblock_end >= SZ_4G + size) { > memblock_set_bottom_up(true); > addr = memblock_alloc_range_nid(size, alignment, SZ_4G, > limit, nid, true); > memblock_set_bottom_up(false); > } > +#endif > > if (!addr) { > addr = memblock_alloc_range_nid(size, alignment, base, -- Sincerely yours, Mike.