[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <245aab40-ea54-eadc-ca9e-e85ef78b7cc7@linux.alibaba.com>
Date: Mon, 16 Mar 2020 09:36:47 -0700
From: Yang Shi <yang.shi@...ux.alibaba.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: shakeelb@...gle.com, vbabka@...e.cz, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mm: swap: make page_evictable() inline
On 3/14/20 9:01 AM, Matthew Wilcox wrote:
> On Sat, Mar 14, 2020 at 02:34:35AM +0800, Yang Shi wrote:
>> -extern int page_evictable(struct page *page);
>> +/*
> This seems to be in kernel-doc format already; could you add the extra
> '*' so it is added to the fine documentation?
Yes, sure.
>
>> + * page_evictable - test whether a page is evictable
>> + * @page: the page to test
>> + *
>> + * Test whether page is evictable--i.e., should be placed on active/inactive
>> + * lists vs unevictable list.
>> + *
>> + * Reasons page might not be evictable:
>> + * (1) page's mapping marked unevictable
>> + * (2) page is part of an mlocked VMA
>> + *
>> + */
>> +static inline int page_evictable(struct page *page)
>> +{
>> + int ret;
>> +
>> + /* Prevent address_space of inode and swap cache from being freed */
>> + rcu_read_lock();
>> + ret = !mapping_unevictable(page_mapping(page)) && !PageMlocked(page);
>> + rcu_read_unlock();
>> + return ret;
>> +}
> This seems like it should return bool ... that might even lead to code
> generation improvement.
Thanks for catching this. It looks mapping_unevictable() needs to be
converted to bool as well.
Powered by blists - more mailing lists