linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yang Shi <yang.shi@linux.alibaba.com>
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: Sat, 14 Mar 2020 09:01:57 -0700	[thread overview]
Message-ID: <20200314160157.GR22433@bombadil.infradead.org> (raw)
In-Reply-To: <1584124476-76534-1-git-send-email-yang.shi@linux.alibaba.com>

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?

> + * 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.


  parent reply	other threads:[~2020-03-14 16:02 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 [this message]
2020-03-16 16:36   ` Yang Shi

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=20200314160157.GR22433@bombadil.infradead.org \
    --to=willy@infradead.org \
    --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=yang.shi@linux.alibaba.com \
    /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