lkml.org 
[lkml]   [2022]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 5/6] mm/page_alloc: Protect PCP lists with a spinlock
From
On 4/26/22 18:42, Nicolas Saenz Julienne wrote:
> On Wed, 2022-04-20 at 10:59 +0100, Mel Gorman wrote:
>> @@ -3082,15 +3093,22 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
>> */
>> void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp)
>> {
>> - unsigned long flags;
>> int to_drain, batch;
>>
>> - local_lock_irqsave(&pagesets.lock, flags);
>> batch = READ_ONCE(pcp->batch);
>> to_drain = min(pcp->count, batch);
>> - if (to_drain > 0)
>> + if (to_drain > 0) {
>> + unsigned long flags;
>> +
>> + /* free_pcppages_bulk expects IRQs disabled for zone->lock */
>> + local_irq_save(flags);
>
> Why dropping the local_lock? That approach is nicer to RT builds, and I don't
> think it makes a difference from a non-RT perspective.

I think the separate irq_disable+spin_lock here is actually broken on RT
config, as explained in Documentation/locking/locktypes.rst. pcp->lock would
have to be a raw_spin_lock.

> That said, IIUC, this will eventually disappear with subsequent patches, right?

So it wouldn't be mergeable even as a temporary step.

>
>> +
>> + spin_lock(&pcp->lock);
>> free_pcppages_bulk(zone, to_drain, pcp, 0);
>> - local_unlock_irqrestore(&pagesets.lock, flags);
>> + spin_unlock(&pcp->lock);
>> +
>> + local_irq_restore(flags);
>> + }
>> }
>> #endif
>>

\
 
 \ /
  Last update: 2022-04-26 18:52    [W:0.085 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site