From: Yang Shi <yang.shi@linux.alibaba.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: shakeelb@google.com, vbabka@suse.cz, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: swap: make page_evictable() inline
Date: Mon, 16 Mar 2020 09:36:47 -0700 [thread overview]
Message-ID: <245aab40-ea54-eadc-ca9e-e85ef78b7cc7@linux.alibaba.com> (raw)
In-Reply-To: <20200314160157.GR22433@bombadil.infradead.org>
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.
prev parent reply other threads:[~2020-03-16 16:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 18:34 Yang Shi
2020-03-13 18:34 ` [PATCH 2/2] mm: swap: use smp_mb__after_atomic() to order LRU bit set Yang Shi
2020-03-16 17:40 ` Vlastimil Babka
2020-03-16 17:49 ` Yang Shi
2020-03-16 22:18 ` Yang Shi
2020-03-13 19:33 ` [PATCH 1/2] mm: swap: make page_evictable() inline Shakeel Butt
2020-03-13 19:46 ` Yang Shi
2020-03-13 19:50 ` Shakeel Butt
2020-03-13 19:54 ` Yang Shi
2020-03-14 16:01 ` Matthew Wilcox
2020-03-16 16:36 ` Yang Shi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=245aab40-ea54-eadc-ca9e-e85ef78b7cc7@linux.alibaba.com \
--to=yang.shi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox