linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Charan Teja Kalla <quic_charante@quicinc.com>
Cc: akpm@linux-foundation.org, markhemm@googlemail.com,
	hughd@google.com, rientjes@google.com, surenb@google.com,
	shakeelb@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND V5,2/2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem
Date: Tue, 24 Jan 2023 16:01:29 +0000	[thread overview]
Message-ID: <Y9AA2cJf+J2MHRKN@casper.infradead.org> (raw)
In-Reply-To: <c2f7242faffd41f46120f82079256ece26b92bf0.1648706231.git.quic_charante@quicinc.com>

On Thu, Mar 31, 2022 at 12:08:21PM +0530, Charan Teja Kalla wrote:
> +static void shmem_isolate_pages_range(struct address_space *mapping, loff_t start,
> +				loff_t end, struct list_head *list)
> +{
> +	XA_STATE(xas, &mapping->i_pages, start);
> +	struct page *page;
> +
> +	rcu_read_lock();
> +	xas_for_each(&xas, page, end) {
> +		if (xas_retry(&xas, page))
> +			continue;
> +		if (xa_is_value(page))
> +			continue;
> +
> +		if (!get_page_unless_zero(page))
> +			continue;
> +		if (isolate_lru_page(page)) {
> +			put_page(page);
> +			continue;
> +		}
> +		put_page(page);
> +
> +		if (PageUnevictable(page) || page_mapcount(page) > 1) {
> +			putback_lru_page(page);
> +			continue;
> +		}
> +
> +		/*
> +		 * Prepare the page to be passed to the reclaim_pages().
> +		 * VM couldn't reclaim the page unless we clear PG_young.
> +		 * Also, to ensure that the pages are written before
> +		 * reclaiming, page is set to dirty.
> +		 * Since we are not clearing the pte_young in the mapped
> +		 * page pte's, its reclaim may not be attempted.
> +		 */
> +		ClearPageReferenced(page);
> +		test_and_clear_page_young(page);
> +		list_add(&page->lru, list);
> +		if (need_resched()) {
> +			xas_pause(&xas);
> +			cond_resched_rcu();
> +		}
> +	}
> +	rcu_read_unlock();
> +}

This entire function needs to be converted to use folios instead of
pages if you're refreshing this patchset for current kernels.



  parent reply	other threads:[~2023-01-24 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31  6:38 [PATCH RESEND V5,0/2]mm: shmem: support POSIX_FADV_[WILL|DONT]NEED for shmem files Charan Teja Kalla
2022-03-31  6:38 ` [PATCH RESEND V5,1/2] mm: fadvise: move 'endbyte' calculations to helper function Charan Teja Kalla
2022-03-31  6:38 ` [PATCH RESEND V5,2/2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem Charan Teja Kalla
2022-05-31 21:21   ` Andrew Morton
2022-06-07 14:52     ` Charan Teja Kalla
2022-06-07 18:24       ` Andrew Morton
2023-01-24 16:01   ` Matthew Wilcox [this message]
2023-01-24 13:28 ` [PATCH RESEND V5,0/2]mm: shmem: support POSIX_FADV_[WILL|DONT]NEED for shmem files Charan Teja Kalla

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=Y9AA2cJf+J2MHRKN@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=markhemm@googlemail.com \
    --cc=quic_charante@quicinc.com \
    --cc=rientjes@google.com \
    --cc=shakeelb@google.com \
    --cc=surenb@google.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