linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Doug Berger <opendmb@gmail.com>
Cc: Jason Baron <jbaron@akamai.com>,
	David Rientjes <rientjes@google.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: include CMA pages in lowmem_reserve at boot
Date: Wed, 19 Aug 2020 10:15:53 -0700	[thread overview]
Message-ID: <e22cbcdc-e9ce-50b7-aa88-6a3579ffd509@gmail.com> (raw)
In-Reply-To: <20200818201817.351499e75cba2a84e8bf33e6@linux-foundation.org>

On 8/18/20 8:18 PM, Andrew Morton wrote:
> On Fri, 14 Aug 2020 09:49:26 -0700 Doug Berger <opendmb@gmail.com> wrote:
> 
>> The lowmem_reserve arrays provide a means of applying pressure
>> against allocations from lower zones that were targeted at
>> higher zones. Its values are a function of the number of pages
>> managed by higher zones and are assigned by a call to the
>> setup_per_zone_lowmem_reserve() function.
>>
>> The function is initially called at boot time by the function
>> init_per_zone_wmark_min() and may be called later by accesses
>> of the /proc/sys/vm/lowmem_reserve_ratio sysctl file.
>>
>> The function init_per_zone_wmark_min() was moved up from a
>> module_init to a core_initcall to resolve a sequencing issue
>> with khugepaged. Unfortunately this created a sequencing issue
>> with CMA page accounting.
>>
>> The CMA pages are added to the managed page count of a zone
>> when cma_init_reserved_areas() is called at boot also as a
>> core_initcall. This makes it uncertain whether the CMA pages
>> will be added to the managed page counts of their zones before
>> or after the call to init_per_zone_wmark_min() as it becomes
>> dependent on link order. With the current link order the pages
>> are added to the managed count after the lowmem_reserve arrays
>> are initialized at boot.
>>
>> This means the lowmem_reserve values at boot may be lower than
>> the values used later if /proc/sys/vm/lowmem_reserve_ratio is
>> accessed even if the ratio values are unchanged.
>>
>> In many cases the difference is not significant, but for example
>> an ARM platform with 1GB of memory and the following memory layout
>> [    0.000000] cma: Reserved 256 MiB at 0x0000000030000000
>> [    0.000000] Zone ranges:
>> [    0.000000]   DMA      [mem 0x0000000000000000-0x000000002fffffff]
>> [    0.000000]   Normal   empty
>> [    0.000000]   HighMem  [mem 0x0000000030000000-0x000000003fffffff]
>>
>> would result in 0 lowmem_reserve for the DMA zone. This would allow
>> userspace to deplete the DMA zone easily.
> 
> Sounds fairly serious for thos machines.  Was a cc:stable considered?

Since there is a Fixes: tag, it may have been assumed that the patch
would be picked up and as soon as it reaches Linus' tree it would be
picked up by the stable selection.
-- 
Florian


  reply	other threads:[~2020-08-19 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 16:49 [PATCH v2] mm: include CMA pages in lowmem_reserve at boot Doug Berger
2020-08-19  3:18 ` Andrew Morton
2020-08-19 17:15   ` Florian Fainelli [this message]
2020-08-19 17:22     ` Andrew Morton
2020-08-19 17:30       ` Florian Fainelli
2020-08-19 17:40         ` Andrew Morton
2020-08-20  0:32           ` Doug Berger

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=e22cbcdc-e9ce-50b7-aa88-6a3579ffd509@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jbaron@akamai.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=opendmb@gmail.com \
    --cc=rientjes@google.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;
as well as URLs for NNTP newsgroup(s).