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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 872ABC433C1 for ; Tue, 30 Mar 2021 15:05:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16A1461953 for ; Tue, 30 Mar 2021 15:05:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16A1461953 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9C8F26B0085; Tue, 30 Mar 2021 11:05:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 978A86B0087; Tue, 30 Mar 2021 11:05:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F2786B0088; Tue, 30 Mar 2021 11:05:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id 633DB6B0085 for ; Tue, 30 Mar 2021 11:05:38 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 15C1F2493 for ; Tue, 30 Mar 2021 15:05:38 +0000 (UTC) X-FDA: 77976864756.29.0BCC2F9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 629E3E005F25 for ; Tue, 30 Mar 2021 15:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617116711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5L4DA/Q6l8UcF5qSBBQB3UwbGkT6Q9l2lLSd3emRQhI=; b=UBlQVrDMacUCQ2kXOCXXZbEx8tO7j0WS2bwNvKMx5ptr7/rhALgDFjdWlql/zT9pGHeoTt ZA8iTGAO4v9nDuANCXhDOwUvXqJmcnBizKdG49T6OXvLQpvN9FtL+E0BwaXQ9y2daQ3+Nl KGbusTcag7dVzdXCeeFvmvXOivGbOgI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617116723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5L4DA/Q6l8UcF5qSBBQB3UwbGkT6Q9l2lLSd3emRQhI=; b=fGbcqYnnuYy56DUQkDqtxvo6kODzQzOMW2BJQozRgFMhU1STLFhsMtylAL89V9zWCnv4r9 fgfLNSg8MnIOwY0UhRCRBT7O8P/zthmvF6LLhd7l4p60nsX8tDHlDyS6bD9LdXdHhTQGNY a3NGcRxcvrVH3B/6ZVaJncH4uIqezBE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-bgTqe6B9OWGX8Tue3LOleg-1; Tue, 30 Mar 2021 11:05:09 -0400 X-MC-Unique: bgTqe6B9OWGX8Tue3LOleg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4EEEE107ACCD; Tue, 30 Mar 2021 15:05:08 +0000 (UTC) Received: from [10.36.114.210] (ovpn-114-210.ams2.redhat.com [10.36.114.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6C3B5D730; Tue, 30 Mar 2021 15:05:06 +0000 (UTC) Subject: Re: [PATCH] mm: change size_t to unsigned int for cma_alloc To: Minchan Kim Cc: Matthew Wilcox , Andrew Morton , linux-mm , LKML References: <20210329182553.3129234-1-minchan@kernel.org> <20210329184431.GJ351017@casper.infradead.org> <6d305211-c956-ad80-5908-703d07fca441@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 30 Mar 2021 17:05:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Stat-Signature: cfnrqy1u88qhaogkwixw6oy61cd559s9 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 629E3E005F25 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617116727-353168 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 30.03.21 17:00, Minchan Kim wrote: > 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. > That's right. > 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", Right you are, teaching alloc_contig_range() to eat "nr_pages" might actually be even better and more consistent. > I'd like to rename it with "alloc_contig_pages|free_contig_pages". alloc_contig_pages is just a wrapper for alloc_contig_range(), so free_contig_range() is a better fit; OTOH, having both would also somehow make sense. > > Since it's beyond the goal of this patch and might be controversial, > I will not deal with it in this patch. Sure, but feel free to send a patch to make that consistent. It's been bugging me already (having to always remember if to pass in nr_pages or end). -- Thanks, David / dhildenb