All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Michal Hocko <mhocko@kernel.org>, David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] mm, migrate: increment fail count on ENOMEM
Date: Fri, 20 May 2016 15:19:12 +0200	[thread overview]
Message-ID: <573F0ED0.4010908@suse.cz> (raw)
In-Reply-To: <20160520130649.GB5197@dhcp22.suse.cz>

On 05/20/2016 03:06 PM, Michal Hocko wrote:
> On Thu 19-05-16 15:11:23, David Rientjes wrote:
>> If page migration fails due to -ENOMEM, nr_failed should still be
>> incremented for proper statistics.
>>
>> This was encountered recently when all page migration vmstats showed 0,
>> and inferred that migrate_pages() was never called, although in reality
>> the first page migration failed because compaction_alloc() failed to find
>> a migration target.
>>
>> This patch increments nr_failed so the vmstat is properly accounted on
>> ENOMEM.
>>
>> Signed-off-by: David Rientjes <rientjes@google.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> One question though
>
>> ---
>>   mm/migrate.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -1171,6 +1171,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>>
>>   			switch(rc) {
>>   			case -ENOMEM:
>> +				nr_failed++;
>>   				goto out;
>>   			case -EAGAIN:
>>   				retry++;
>
> Why don't we need also to count also retries?

We could, but not like you suggest.

> ---
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 53ab6398e7a2..ef9c5211ae3c 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1190,9 +1190,9 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>   			}
>   		}
>   	}
> +out:
>   	nr_failed += retry;
>   	rc = nr_failed;

This overwrites rc == -ENOMEM, which at least compaction needs to 
recognize. But we could duplicate "nr_failed += retry" in the case -ENOMEM.

> -out:
>   	if (nr_succeeded)
>   		count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
>   	if (nr_failed)
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz>
To: Michal Hocko <mhocko@kernel.org>, David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] mm, migrate: increment fail count on ENOMEM
Date: Fri, 20 May 2016 15:19:12 +0200	[thread overview]
Message-ID: <573F0ED0.4010908@suse.cz> (raw)
In-Reply-To: <20160520130649.GB5197@dhcp22.suse.cz>

On 05/20/2016 03:06 PM, Michal Hocko wrote:
> On Thu 19-05-16 15:11:23, David Rientjes wrote:
>> If page migration fails due to -ENOMEM, nr_failed should still be
>> incremented for proper statistics.
>>
>> This was encountered recently when all page migration vmstats showed 0,
>> and inferred that migrate_pages() was never called, although in reality
>> the first page migration failed because compaction_alloc() failed to find
>> a migration target.
>>
>> This patch increments nr_failed so the vmstat is properly accounted on
>> ENOMEM.
>>
>> Signed-off-by: David Rientjes <rientjes@google.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> One question though
>
>> ---
>>   mm/migrate.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -1171,6 +1171,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>>
>>   			switch(rc) {
>>   			case -ENOMEM:
>> +				nr_failed++;
>>   				goto out;
>>   			case -EAGAIN:
>>   				retry++;
>
> Why don't we need also to count also retries?

We could, but not like you suggest.

> ---
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 53ab6398e7a2..ef9c5211ae3c 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1190,9 +1190,9 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>   			}
>   		}
>   	}
> +out:
>   	nr_failed += retry;
>   	rc = nr_failed;

This overwrites rc == -ENOMEM, which at least compaction needs to 
recognize. But we could duplicate "nr_failed += retry" in the case -ENOMEM.

> -out:
>   	if (nr_succeeded)
>   		count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
>   	if (nr_failed)
>

  reply	other threads:[~2016-05-20 13:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 22:11 [patch] mm, migrate: increment fail count on ENOMEM David Rientjes
2016-05-19 22:11 ` David Rientjes
2016-05-20 13:06 ` Michal Hocko
2016-05-20 13:06   ` Michal Hocko
2016-05-20 13:19   ` Vlastimil Babka [this message]
2016-05-20 13:19     ` Vlastimil Babka
2016-05-20 13:31     ` Michal Hocko
2016-05-20 13:31       ` Michal Hocko
2016-05-23 22:02       ` Andrew Morton
2016-05-23 22:02         ` Andrew Morton
2016-05-23 23:32         ` Hugh Dickins
2016-05-23 23:32           ` Hugh Dickins
2016-05-24  6:17           ` Michal Hocko
2016-05-24  6:17             ` Michal Hocko

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=573F0ED0.4010908@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=rientjes@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.