linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <yang.shi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: willy@infradead.org, mhocko@suse.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: migrate.c: migrate PG_readahead flag
Date: Thu, 13 Feb 2020 19:58:40 -0800	[thread overview]
Message-ID: <c5936806-dc0b-e0a2-33f0-6d6dce45e0a9@linux.alibaba.com> (raw)
In-Reply-To: <20200213185511.4660aca17553562d764dc7ea@linux-foundation.org>



On 2/13/20 6:55 PM, Andrew Morton wrote:
> On Fri, 14 Feb 2020 08:29:45 +0800 Yang Shi <yang.shi@linux.alibaba.com> wrote:
>
>> Currently migration code doesn't migrate PG_readahead flag.
>> Theoretically this would incur slight performance loss as the
>> application might have to ramp its readahead back up again.  Even though
>> such problem happens, it might be hidden by something else since
>> migration is typically triggered by compaction and NUMA balancing, any
>> of which should be more noticeable.
>>
>> Migrate the flag after end_page_writeback() since it may clear
>> PG_reclaim flag, which is the same bit as PG_readahead, for the new
>> page.
>>
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -647,6 +647,14 @@ void migrate_page_states(struct page *newpage, struct page *page)
>>   	if (PageWriteback(newpage))
>>   		end_page_writeback(newpage);
>>   
>> +	/*
>> +	 * PG_readahead share the same bit with PG_reclaim, the above
>> +	 * end_page_writeback() may clear PG_readahead mistakenly, so set
>> +	 * the bit after that.
>> +	 */
>> +	if (PageReadahead(page))
>> +		SetPageReadahead(newpage);
>> +
>>   	copy_page_owner(page, newpage);
>>   
> Why not

The newpage may not have writeback set, migrating readahead flag should 
not depend on it.

>
>    	if (PageWriteback(newpage)) {
>    		end_page_writeback(newpage);
> 		/*
> 		 * PG_readahead share the same bit with PG_reclaim, the above
> 		 * end_page_writeback() may clear PG_readahead mistakenly, so
> 		 * set the bit after that.
> 		 */
> 		if (PageReadahead(page))
> 			SetPageReadahead(newpage);
> 	}
>
> ?



  reply	other threads:[~2020-02-14  3:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14  0:29 Yang Shi
2020-02-14  2:55 ` Andrew Morton
2020-02-14  3:58   ` Yang Shi [this message]
2020-02-14  4:07     ` Matthew Wilcox
2020-02-14  8:34 ` Michal Hocko
2020-02-14 10:04 ` David Hildenbrand

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=c5936806-dc0b-e0a2-33f0-6d6dce45e0a9@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=mhocko@suse.com \
    --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