Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Jan Kara <jack@suse.cz>
Cc: linux-mm@kvack.org, mhocko@suse.cz
Subject: Re: [PATCH 1/6] mm: migration: Factor out code to compute expected number of page references
Date: Fri, 14 Dec 2018 15:10:46 +0000
Message-ID: <20181214151045.GG28934@suse.de> (raw)
In-Reply-To: <20181211172143.7358-2-jack@suse.cz>

On Tue, Dec 11, 2018 at 06:21:38PM +0100, Jan Kara wrote:
> Factor out function to compute number of expected page references in
> migrate_page_move_mapping(). Note that we move hpage_nr_pages() and
> page_has_private() checks from under xas_lock_irq() however this is safe
> since we hold page lock.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  mm/migrate.c | 27 +++++++++++++++++----------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index f7e4bfdc13b7..789c7bc90a0c 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -428,6 +428,22 @@ static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
>  }
>  #endif /* CONFIG_BLOCK */
>  
> +static int expected_page_refs(struct page *page)
> +{
> +	int expected_count = 1;
> +
> +	/*
> +	 * Device public or private pages have an extra refcount as they are
> +	 * ZONE_DEVICE pages.
> +	 */
> +	expected_count += is_device_private_page(page);
> +	expected_count += is_device_public_page(page);
> +	if (page->mapping)
> +		expected_count += hpage_nr_pages(page) + page_has_private(page);
> +
> +	return expected_count;
> +}
> +

I noticed during testing that THP allocation success rates under the
mmtests configuration global-dhp__workload_thpscale-madvhugepage-xfs were
terrible with massive latencies introduced somewhere in the series. I
haven't tried chasing it down as it's relatively late but this block
looked odd and I missed it the first time.

This page->mapping test is relevant for the "Anonymous page without
mapping" check but I think it's wrong. An anonymous page without mapping
doesn't have a NULL mapping, it sets PAGE_MAPPING_ANON and the field can
be special in other ways. I think you meant to use page_mapping(page)
here, not page->mapping?

-- 
Mel Gorman
SUSE Labs

  parent reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 17:21 mm: migrate: Fix page migration stalls for blkdev pages Jan Kara
2018-12-11 17:21 ` [PATCH 1/6] mm: migration: Factor out code to compute expected number of page references Jan Kara
2018-12-13 13:05   ` Mel Gorman
2018-12-14 15:10   ` Mel Gorman [this message]
2018-12-14 15:53     ` Jan Kara
2018-12-14 16:24       ` Mel Gorman
2018-12-17 13:11         ` Jan Kara
2018-12-11 17:21 ` [PATCH 2/6] mm: migrate: Lock buffers before migrate_page_move_mapping() Jan Kara
2018-12-13 14:19   ` Mel Gorman
2018-12-11 17:21 ` [PATCH 3/6] mm: migrate: Move migrate_page_lock_buffers() Jan Kara
2018-12-13 14:57   ` Mel Gorman
2018-12-11 17:21 ` [PATCH 4/6] mm: migrate: Provide buffer_migrate_page_norefs() Jan Kara
2018-12-13 15:34   ` Mel Gorman
2018-12-14  4:53   ` Andrew Morton
2018-12-14  9:26     ` Jan Kara
2018-12-11 17:21 ` [PATCH 5/6] blkdev: Avoid migration stalls for blkdev pages Jan Kara
2018-12-13 15:35   ` Mel Gorman
2018-12-11 17:21 ` [PATCH 6/6] mm: migrate: Drop unused argument of migrate_page_move_mapping() Jan Kara
2018-12-13 15:35   ` Mel Gorman
2018-12-13 16:17     ` Jan Kara
2018-12-17 13:17       ` Jan Kara

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=20181214151045.GG28934@suse.de \
    --to=mgorman@suse.de \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git