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: <CAOptpSMZtw8xEHqgu-ufdQouiAHpitkQtBdFXmEbRGQ+FSAWYA@mail.gmail.com>
Date: Fri, 25 Apr 2025 22:57:54 +0800
From: Wenchao Hao <haowenchao22@...il.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/compaction: do not break pages whose order is larger
 than target order

On Fri, Apr 25, 2025 at 2:53 PM Baolin Wang
<baolin.wang@...ux.alibaba.com> wrote:
>
>
>
> On 2025/4/24 23:38, Wenchao Hao wrote:
> > When scanning free pages for memory compaction, if the compaction target
> > order is explicitly specified, do not split pages in buddy whose order
> > are larger than compaction target order.
>
> We've already checked this in suitable_migration_target(), so how did
> you observe that there are still attempts to isolate such non-suitable
> free large folios? Please explain your usecase in detail.
>

I found such non-suitable during testing proactive compaction on
android device (6.6 kernel), and I want to use proactive compaction
to produce order4 pages for mthp.

The test device did not include your patch "mm: compaction: limit the suitable
target page order to be less than cc->order".

However, from the analysis of the code flow, even if it is included,
similar non-suitable free large folios may still appear.

suitable_migration_target() only check before isolate_freepages_block(), and
check is based on the starting page of pageblock.

If the target order is relatively small(order4 for example), just one check in
suitable_migration_target() is not enough, because there may be other free
folios which are larger than order4 in this pageblock.

> > Signed-off-by: Wenchao Hao <haowenchao22@...il.com>
> > ---
> >   mm/compaction.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/mm/compaction.c b/mm/compaction.c
> > index 3925cb61dbb8..b0ed0831c400 100644
> > --- a/mm/compaction.c
> > +++ b/mm/compaction.c
> > @@ -656,6 +656,17 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
> >
> >               /* Found a free page, will break it into order-0 pages */
> >               order = buddy_order(page);
> > +
> > +             /*
> > +              * Do not break free pages whose order is larger than
> > +              * compact's desired order
> > +              */
> > +             if (cc->order != -1 && order >= cc->order) {
> > +                     blockpfn += (1 << order) - 1;
> > +                     page += (1 << order) - 1;
> > +                     goto isolate_fail;
> > +             }
> > +
> >               isolated = __isolate_free_page(page, order);
> >               if (!isolated)
> >                       break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ