lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d22b04d6-85d6-9b3c-d218-d16f797dd30f@redhat.com>
Date:   Tue, 30 Mar 2021 17:05:05 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Minchan Kim <minchan@...nel.org>
Cc:     Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: change size_t to unsigned int for cma_alloc

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@...hat.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ