From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0277CC433DB for ; Tue, 30 Mar 2021 15:00:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F00661921 for ; Tue, 30 Mar 2021 15:00:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F00661921 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 031A86B0081; Tue, 30 Mar 2021 11:00:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F23786B0083; Tue, 30 Mar 2021 11:00:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEBE26B0085; Tue, 30 Mar 2021 11:00:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id C2C336B0081 for ; Tue, 30 Mar 2021 11:00:34 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 81E0B1DF0 for ; Tue, 30 Mar 2021 15:00:34 +0000 (UTC) X-FDA: 77976851988.29.595444D Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf26.hostedemail.com (Postfix) with ESMTP id 39E2140F8C07 for ; Tue, 30 Mar 2021 15:00:20 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id v186so11903701pgv.7 for ; Tue, 30 Mar 2021 08:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/qq9/gIIEeXADeexes6T1XgVO8U+5a7euiGrNKdM3Sg=; b=bm/Eg6NESu4elfE4WuREbNTQh+xPdY09j3P9cbjk4TTNFOgL/jkCa7tV/Lljy4c3bW Px6TiZpZ/QxtVpxrnRmwEePpwNYlNZLO68NpfDPtooB2P3ONyUY8sZHZH9mqBUoyGd31 uogFdNYOktS/c11AEHMM7Z31uiZQQS9EO/HrmSM5qghr4qIdiXFMriAoR7VDbkc8q9pi s8XrP3cP4GdA0tRvWzR2wfU2YsL+P/qQrTL75k6GlFZuEHj9UoCSmx1cKDrPAvXZpLZK bY5L8GHG12vsK2/njEz2Cs3c/KHVr5iJGGoSVSzZWtHVpgDQorvftY2Gdi+ed4513iDh nOBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=/qq9/gIIEeXADeexes6T1XgVO8U+5a7euiGrNKdM3Sg=; b=mejlM346OsuZXCA4ESOGsFeTnOau1xHtL7EZ9as/eRQ06z6Yd5cUXDCsIyuGGI65gg 3vgJQCezR1zmjCJ+VTmJDIatmZqKsOrO44c8MNUKQIMmNvOiuVD3GMlclFSzvhqI6Tg+ hdKrHQHbTf1ccRL0+WV+K8sSVgzhtskktGNI5ihXEQHtz8T4MquyFW1IvdpLBE43DOa7 EIjSjb2TcCceS/F6GlF2bYaRaSrAtWSJ8BeLJbs+6ezlSrHN/kFsNTU1CPKMScSt9jTv WwznF4pxtrmBJtaD9sHzhHLUr6/j94cVJrMp1PoJWAbV4J1iEQnx9TLYhcQmMM0NXo5r vlkw== X-Gm-Message-State: AOAM532hWNiALvbfoQ0eoxMZOqEECD7yZG6ueswY+TIxEiiTVCfzx5nR uUO9OhPoJJt3dJ7yGBxoRxc= X-Google-Smtp-Source: ABdhPJz0rb7f8RU62drqneEGfK2vP4mE/UKEqmlWC4Af1YhpCwvHdG9jTSIFDMfSpOkQbOBReZFKAA== X-Received: by 2002:a62:1ad0:0:b029:1f2:c7b3:3039 with SMTP id a199-20020a621ad00000b02901f2c7b33039mr31316429pfa.30.1617116416305; Tue, 30 Mar 2021 08:00:16 -0700 (PDT) Received: from google.com ([2620:15c:211:201:e1ca:cef0:ac9e:7cda]) by smtp.gmail.com with ESMTPSA id g15sm6600625pfk.36.2021.03.30.08.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Mar 2021 08:00:15 -0700 (PDT) Date: Tue, 30 Mar 2021 08:00:13 -0700 From: Minchan Kim To: David Hildenbrand Cc: Matthew Wilcox , Andrew Morton , linux-mm , LKML Subject: Re: [PATCH] mm: change size_t to unsigned int for cma_alloc Message-ID: References: <20210329182553.3129234-1-minchan@kernel.org> <20210329184431.GJ351017@casper.infradead.org> <6d305211-c956-ad80-5908-703d07fca441@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d305211-c956-ad80-5908-703d07fca441@redhat.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 39E2140F8C07 X-Stat-Signature: 37xxeuduzkbwtmhnb55a8jeo58t8zux9 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail-pg1-f175.google.com; client-ip=209.85.215.175 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617116420-483625 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Mar 30, 2021 at 09:58:37AM +0200, David Hildenbrand wrote: > On 29.03.21 22:12, Minchan Kim wrote: > > On Mon, Mar 29, 2021 at 07:44:31PM +0100, Matthew Wilcox wrote: > > > On Mon, Mar 29, 2021 at 11:25:53AM -0700, Minchan Kim wrote: > > > > size_t in cma_alloc is confusing since it makes people think > > > > it's byte count, not pages. Fix it. > > > > > > i think it has to be unsigned long. > > > > > > 67a2e213e7e937c41c52ab5bc46bf3f4de469f6e > > Right. > > Fortunately, we don't have such large allocations yet via > CMA/alloc_contig_range > > > > > Thanks for the pinter. I wanted to have the smallest change. > > The commit leads me to change cma_release, trace_cma_alloc, > > cma_clear_bitmap and front_contig_range as well.(Not sure > > we have more. Will check). > > > > Ccing david@redhat.com for upcoming changing free_contig_range. > > While at it, we might want to convert free_contig_range() to eat > "unsigned long start, unsigned long end" like alloc_contig_range(), instead > of "unsigned long pfn, unsigned int nr_pages" like alloc_contig_pages() ... Well, I personllay tempted to change alloc_contig_range, not free_contig_range because base_pfn with nr_pages was more straightforward than base_pfn and end_pfn in that we don't need to tell whether end_pfn is inclusive or exclusive. When I look at callers of [alloc|free]_contig_range, many of them already have used nr_pages based approach rather than start_pfn, end_pfn. If your suggestion come from that "it's *range* API", I'd like to rename it with "alloc_contig_pages|free_contig_pages". Since it's beyond the goal of this patch and might be controversial, I will not deal with it in this patch.