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] [day] [month] [year] [list]
Message-ID: <ea9c8972-9166-49bb-4b33-900e58cf1c8c@suse.cz>
Date:   Mon, 2 Nov 2020 14:07:13 +0100
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Zi Yan <ziy@...dia.com>, Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm@...ck.org
Cc:     Yang Shi <shy828301@...il.com>, Michal Hocko <mhocko@...e.com>,
        Rik van Riel <riel@...riel.com>,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v3 2/2] mm/compaction: stop isolation if too many pages
 are isolated and we have pages to migrate.

On 10/30/20 7:38 PM, Zi Yan wrote:
> From: Zi Yan <ziy@...dia.com>
> 
> In isolate_migratepages_block, if we have too many isolated pages and
> nr_migratepages is not zero, we should try to migrate what we have
> without wasting time on isolating.

As you CC stable, there should be a stronger reason (strictly speaking the 
problem should have been observed in practice, but this is a simple patch, so 
they could accept it), so I suggest Andrew adds the following paragraph:

In theory it's possible that multiple parallel compactions will cause 
too_many_isolated() to become true even if each has isolated less than 
COMPACT_CLUSTER_MAX, and loop forever in the while loop. Bailing immediately 
prevents that.

> Fixes: 1da2f328fa64 (“mm,thp,compaction,cma: allow THP migration for CMA allocations”)
> Suggested-by: Vlastimil Babka <vbabka@...e.cz>
> Signed-off-by: Zi Yan <ziy@...dia.com>
> Cc: <stable@...r.kernel.org>

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

> ---
>   mm/compaction.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 3e834ac402f1..4d237a7c3830 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -817,6 +817,10 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>   	 * delay for some time until fewer pages are isolated
>   	 */
>   	while (unlikely(too_many_isolated(pgdat))) {
> +		/* stop isolation if there are still pages not migrated */
> +		if (cc->nr_migratepages)
> +			return 0;
> +
>   		/* async migration should just abort */
>   		if (cc->mode == MIGRATE_ASYNC)
>   			return 0;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ