lkml.org 
[lkml]   [2020]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 03/10] mm/lru: replace pgdat lru_lock with lruvec lock
From
Date


在 2020/1/13 下午11:41, Daniel Jordan 写道:
> Hi Alex,
>
> On Wed, Dec 25, 2019 at 05:04:19PM +0800, Alex Shi wrote:
>> @@ -900,6 +904,29 @@ static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
>> {
>> return &pgdat->__lruvec;
>> }
>> +#define lock_page_lruvec_irq(page) \
>> +({ \
>> + struct pglist_data *pgdat = page_pgdat(page); \
>> + spin_lock_irq(&pgdat->__lruvec.lru_lock); \
>> + &pgdat->__lruvec; \
>> +})
>> +
>> +#define lock_page_lruvec_irqsave(page, flagsp) \
>> +({ \
>> + struct pglist_data *pgdat = page_pgdat(page); \
>> + spin_lock_irqsave(&pgdat->__lruvec.lru_lock, *flagsp); \
>> + &pgdat->__lruvec; \
>> +})
>> +
>> +#define unlock_page_lruvec_irq(lruvec) \
>> +({ \
>> + spin_unlock_irq(&lruvec->lru_lock); \
>> +})
>> +
>> +#define unlock_page_lruvec_irqrestore(lruvec, flags) \
>> +({ \
>> + spin_unlock_irqrestore(&lruvec->lru_lock, flags); \
>> +})
>
> Noticed this while testing your series. These are safe as inline functions, so
> I think you may have gotten the wrong impression when Johannes made this point:
>
> https://lore.kernel.org/linux-mm/20191119164448.GA396644@cmpxchg.org/
>

Thanks for reminder! Daniel!

I write them to macro, since I guess it's more favorite for some guys. It's do a bit more neat than function although cost a bit readablity.

Thanks a lot! :)
Alex

\
 
 \ /
  Last update: 2020-01-14 07:37    [W:0.058 / U:4.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site