From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
"zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
steve.kang@unisoc.com, Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCHv6 1/1] mm: optimization on page allocation when CMA enabled
Date: Tue, 2 Jan 2024 13:50:16 +0800 [thread overview]
Message-ID: <CAGWkznFLP7ACf0mxkSoLefewzaoRL38RJ13PXvFmZCgcvx+63A@mail.gmail.com> (raw)
In-Reply-To: <20231229114032.64d5320a97a7c776e10e8acf@linux-foundation.org>
On Sat, Dec 30, 2023 at 3:40 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 8 Nov 2023 16:55:19 +0800 Zhaoyang Huang <huangzhaoyang@gmail.com> wrote:
>
> > > > +static bool use_cma_first(struct zone *zone, unsigned int order, unsigned int alloc_flags)
> > > > +{
> > > > + unsigned long watermark;
> > > > + bool cma_first = false;
> > > > +
> > > > + watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
> > > > + /* check if GFP_MOVABLE pass previous zone_watermark_ok via the help of CMA */
> > > > + if (zone_watermark_ok(zone, order, watermark, 0, alloc_flags & (~ALLOC_CMA))) {
> > > > + /*
> > > > + * Balance movable allocations between regular and CMA areas by
> > > > + * allocating from CMA when over half of the zone's free memory
> > > > + * is in the CMA area.
> > > > + */
> > ok, thanks for point out.
> > Could we simple it like this, which will mis-judge kmalloc within
> > ioctl as GFP_USER. I think it is ok as it is rare
> > if (current_is_kswapd() || !current->mm)
> > gfp_flags = GFP_KERNEL;
> > else
> > gfp_flags = GFP_USER;
> > free_pages = zone_page_state(zone, NR_FREE_PAGES);
> > free_pages -= zone->lowmem_reserve[gfp_zone(gfp_flags)];
> > free_pages -= wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
> > cma_first = free_pages > zone_page_state(zone, NR_FREE_PAGES) / 2);
> >
>
> This went all quiet. Do we feel that "mm: optimization on page
> allocation when CMA enabled" should be merged as-is, or dropped in the
> expectation that something based on Johannes's suggestion will be
> developed?
I just establish a v6.6 environment and will provide comparison
results with and without the patch
>
prev parent reply other threads:[~2024-01-02 5:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 7:12 zhaoyang.huang
2023-10-16 22:39 ` Andrew Morton
2023-10-17 2:32 ` Zhaoyang Huang
2023-11-07 17:28 ` Johannes Weiner
2023-11-08 8:55 ` Zhaoyang Huang
2023-12-29 19:40 ` Andrew Morton
2024-01-02 5:50 ` Zhaoyang Huang [this message]
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=CAGWkznFLP7ACf0mxkSoLefewzaoRL38RJ13PXvFmZCgcvx+63A@mail.gmail.com \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=roman.gushchin@linux.dev \
--cc=steve.kang@unisoc.com \
--cc=vbabka@suse.cz \
--cc=zhaoyang.huang@unisoc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox