All of lore.kernel.org
 help / color / mirror / Atom feed
From: Park Sangwoo <sangwoo2.park@lge.com>
To: mhocko@kernel.org
Cc: hannes@cmpxchg.org, arunks@codeaurora.org, guro@fb.com,
	richard.weiyang@gmail.com, glider@google.com, jannh@google.com,
	dan.j.williams@intel.com, akpm@linux-foundation.org,
	alexander.h.duyck@linux.intel.com, rppt@linux.vnet.ibm.com,
	gregkh@linuxfoundation.org, janne.huttunen@nokia.com,
	pasha.tatashin@soleen.com, vbabka@suse.cz, osalvador@suse.de,
	mgorman@techsingularity.net, khlebnikov@yandex-team.ru,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: Re: Re: Re: [PATCH] mm: Add nr_free_highatomimic to fix incorrect watermatk routine
Date: Wed, 4 Sep 2019 15:54:57 +0900	[thread overview]
Message-ID: <20190904065457.GA19826@LGEARND18B2> (raw)

> On Tue 03-09-19 18:59:59, Park Sangwoo wrote:
> > On Mon 02-09-19 13:34:54, Sangwoo� wrote:
> >>> On Fri 30-08-19 18:25:53, Sangwoo wrote:
> >>>> The highatomic migrate block can be increased to 1% of Total memory.
> >>>> And, this is for only highorder ( > 0 order). So, this block size is
> >>>> excepted during check watermark if allocation type isn't alloc_harder.
> >>>>
> >>>> It has problem. The usage of highatomic is already calculated at
> >>> NR_FREE_PAGES.
> >>>>> So, if we except total block size of highatomic, it's twice minus size of
> >>> allocated
> >>>>> highatomic.
> >>>>> It's cause allocation fail although free pages enough.
> >>>>>
> >>>>> We checked this by random test on my target(8GB RAM).
> >>>>>
> >>>>>  Binder:6218_2: page allocation failure: order:0, mode:0x14200ca
> >>> (GFP_HIGHUSER_MOVABLE), nodemask=(null)
> >>>>>  Binder:6218_2 cpuset=background mems_allowed=0
> >>>>
> >>>> How come this order-0 sleepable allocation fails? The upstream kernel
> >>>> doesn't fail those allocations unless the process context is killed by
> >>>> the oom killer.
> >>> 
> >>> Most calltacks are zsmalloc, as shown below.
> >>
> >> What makes those allocations special so that they fail unlike any other
> >> normal order-0 requests? Also do you see the same problem with the
> >> current upstream kernel? Is it possible this is an Android specific
> >> issue?
> >
> > There is the other case of fail order-0 fail.
> > ----
> > hvdcp_opti: page allocation failure: order:0, mode:0x1004000(GFP_NOWAIT|__GFP_COMP), nodemask=(null)
> 
> This is an atomic allocation and failing that one is not a problem
> usually. High atomic reservations might prevent GFP_NOWAIT allocation
> from suceeding but I do not see that as a problem. This is the primary
> purpose of the reservation. 

Thanks, your answer helped me. However, my suggestion is not to modify the use and management of the high atomic region,
but to calculate the exact free size of the highatomic so that fail does not occur for previously shared cases.

In __zone_water_mark_ok(...) func, if it is not atomic allocation, high atomic size is excluded.

bool __zone_watermark_ok(struct zone *z,
...
{
    ...
    if (likely(!alloc_harder)) {
        free_pages -= z->nr_reserved_highatomic;
    ...
}

However, free_page excludes the size already allocated by hiahtomic.
If highatomic block is small(Under 4GB RAM), it could be no problem.
But, the larger the memory size, the greater the chance of problems.
(Becasue highatomic size can be increased up to 1% of memory)

> [...]
> > In my test, most case are using camera. So, memory usage is increased momentarily,
> > it cause free page go to under low value of watermark.
> > If free page is under low and 0-order fail is occured, its normal operation.
> > But, although free page is higher than min, fail is occurred.
> > After fix routin for checking highatomic size, it's not reproduced.
> 
> But you are stealing from the atomic reserves and thus defeating the
> purpose of it.


             reply	other threads:[~2019-09-04  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  6:54 Park Sangwoo [this message]
2019-09-04  8:19 ` Re: Re: Re: [PATCH] mm: Add nr_free_highatomimic to fix incorrect watermatk routine Michal Hocko

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=20190904065457.GA19826@LGEARND18B2 \
    --to=sangwoo2.park@lge.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=arunks@codeaurora.org \
    --cc=dan.j.williams@intel.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=janne.huttunen@nokia.com \
    --cc=jannh@google.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@soleen.com \
    --cc=richard.weiyang@gmail.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.