Re: [PATCH v2 1/8] mm/cma: change cma mutex to irq safe spinlock

From: Mike Kravetz
Date: Mon Mar 29 2021 - 22:20:08 EST


On 3/29/21 6:20 PM, Song Bao Hua (Barry Song) wrote:
>
>
>> -----Original Message-----
>> From: Mike Kravetz [mailto:mike.kravetz@xxxxxxxxxx]
>> Sent: Tuesday, March 30, 2021 12:24 PM
>> To: linux-mm@xxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
>> Cc: Roman Gushchin <guro@xxxxxx>; Michal Hocko <mhocko@xxxxxxxx>; Shakeel Butt
>> <shakeelb@xxxxxxxxxx>; Oscar Salvador <osalvador@xxxxxxx>; David Hildenbrand
>> <david@xxxxxxxxxx>; Muchun Song <songmuchun@xxxxxxxxxxxxx>; David Rientjes
>> <rientjes@xxxxxxxxxx>; linmiaohe <linmiaohe@xxxxxxxxxx>; Peter Zijlstra
>> <peterz@xxxxxxxxxxxxx>; Matthew Wilcox <willy@xxxxxxxxxxxxx>; HORIGUCHI NAOYA
>> <naoya.horiguchi@xxxxxxx>; Aneesh Kumar K . V <aneesh.kumar@xxxxxxxxxxxxx>;
>> Waiman Long <longman@xxxxxxxxxx>; Peter Xu <peterx@xxxxxxxxxx>; Mina Almasry
>> <almasrymina@xxxxxxxxxx>; Hillf Danton <hdanton@xxxxxxxx>; Joonsoo Kim
>> <iamjoonsoo.kim@xxxxxxx>; Song Bao Hua (Barry Song)
>> <song.bao.hua@xxxxxxxxxxxxx>; Will Deacon <will@xxxxxxxxxx>; Andrew Morton
>> <akpm@xxxxxxxxxxxxxxxxxxxx>; Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>> Subject: [PATCH v2 1/8] mm/cma: change cma mutex to irq safe spinlock
>>
>> Ideally, cma_release could be called from any context. However, that is
>> not possible because a mutex is used to protect the per-area bitmap.
>> Change the bitmap to an irq safe spinlock.
>>
>> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>
> It seems mutex_lock is locking some areas with bitmap operations which
> should be safe to atomic context.
>
> Reviewed-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>

Thanks Barry,

Not sure if you saw questions from Michal in previous series?
There was some concern from Joonsoo in the past about lock hold time due
to bitmap scans. You may have some insight into the typical size of CMA
areas on arm64. I believe the calls to set up the areas specify one bit
per page.
--
Mike Kravetz