public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	dave.hansen@linux.intel.com, bp@alien8.de, hpa@zytor.com,
	hch@lst.de, m.szyprowski@samsung.com,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, djakov@kernel.org
Subject: Re: [RFC] mm: Allow ZONE_DMA32 to be disabled via kernel command line
Date: Fri, 27 Jan 2023 16:55:53 +0800	[thread overview]
Message-ID: <20230127085553.5120-1-hdanton@sina.com> (raw)
In-Reply-To: <20230127021348.GA3754@hu-cgoldswo-sd.qualcomm.com>

On Thu, 26 Jan 2023 18:20:26 -0800 Chris Goldsworthy <quic_cgoldswo@quicinc.com>
> On Thu, Jan 26, 2023 at 07:15:26PM +0000, Robin Murphy wrote:
> > On 2023-01-26 16:43, Georgi Djakov wrote:
> > >From: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
> > >
> > >It's useful to have an option to disable the ZONE_DMA32 during boot as
> > >CONFIG_ZONE_DMA32 is by default enabled (on multiplatform kernels for
> > >example). There are platforms that do not use this zone and in some high
> > >memory pressure scenarios this would help on easing kswapd (to leave file
> > >backed memory intact / unreclaimed). When the ZONE_DMA32 is enabled on
> > >these platforms - kswapd is woken up more easily and drains the file cache
> > >which leads to some performance issues.
> > >
> > >Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
> > >[georgi: updated commit text]
> > >Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
> > >---
> > >The main question here is whether we can have a kernel command line
> > >option to disable CONFIG_ZONE_DMA32 during boot (at least on arm64).
> > >I can imagine this being useful also for Linux distros.
> > 
> > FWIW I'd say that "disabled" and "left empty then awkwardly tiptoed around
> > in a few places" are very different notions...
> > 
> > However, I'm just going to take a step back and read the commit message a
> > few more times... Given what it claims, I can't help but ask why wouldn't we
> > want a parameter to control kswapd's behaviour and address that issue
> > directly, rather than a massive hammer that breaks everyone allocating
> > explicitly or implicitly with __GFP_DMA32 (especially on systems where it
> > doesn't normally matter because all memory is below 4GB anyway), just to
> > achieve one rather niche side-effect?
> > 
> > Thanks,
> > Robin.
> 
> Hi Robin,
> 
> The commit text doesn't spell out the scenario we want to avoid, so I
> will do that for clarity. We use a kernel binary compiled for us, and
> by default has CONFIG_ZONE_DMA32 (and it can't be disabled for now as
> another party needs it). Our higher-end SoCs are usually used with
> 8-12 GB of DDR, so using a 12 GB device as an example, we would have 8
> GB of ZONE_NORMAL memory and 4 GB of ZONE_MOVABLE memory with the
> feature, and 4 GB of ZONE_DMA32, 4 GB of ZONE_NORMAL and 4 GB of
> ZONE_MOVABLE otherwise.
> 
> Without the feature enabled, consider a GFP_KERNEL allocation that
> causes a low watermark beach in ZONE_NORMAL, such that such that
> ZONE_DMA32 is almost full. This will cause kswapd to start reclaiming
> memory, despite the fact that that we might have gigabytes of free
> memory in ZONE_DMA32 that can be used by anyone (since GFP_MOVABLE and
> GFP_NORMAL can fall back to using ZONE_DMA32).

If kswapd is busy reclaiming pages even given gigabytes of free memory
in the DMA32 zone then it is a CPU hog.

Feel free to check pgdat_balanced() and prepare_kswapd_sleep().
> 
> So, fleshing out your suggestion to make it concrete for our case, we
> would want to stop kswapd from doing reclaim on ZONE_NORMAL watermark
> breaches when ZONE_DMA32 is present (since anything targeting
> ZONE_NORMAL can fall back to ZONE_DMA32).
> 
> Thanks,
> 
> Chris.
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-01-27  8:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 16:43 [RFC] mm: Allow ZONE_DMA32 to be disabled via kernel command line Georgi Djakov
2023-01-26 18:51 ` Dave Hansen
2023-01-26 22:56   ` Georgi Djakov
2023-01-27  0:57   ` Randy Dunlap
2023-01-27  6:35   ` Christoph Hellwig
2023-01-27  6:52     ` H. Peter Anvin
2023-01-27  7:07       ` Christoph Hellwig
2023-01-26 19:15 ` Robin Murphy
2023-01-27  2:20   ` Chris Goldsworthy
2023-01-27  8:55     ` Hillf Danton [this message]
2023-02-01  4:09       ` Chris Goldsworthy

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=20230127085553.5120-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=djakov@kernel.org \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=iommu@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=quic_cgoldswo@quicinc.com \
    --cc=robin.murphy@arm.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