lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <573F0ED0.4010908@suse.cz>
Date:	Fri, 20 May 2016 15:19:12 +0200
From:	Vlastimil Babka <vbabka@...e.cz>
To:	Michal Hocko <mhocko@...nel.org>,
	David Rientjes <rientjes@...gle.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...hsingularity.net>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [patch] mm, migrate: increment fail count on ENOMEM

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@...gle.com>
>
> Acked-by: Michal Hocko <mhocko@...e.com>

Acked-by: Vlastimil Babka <vbabka@...e.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)
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ