From: Michal Hocko <mhocko@suse.com>
To: Huang Ying <ying.huang@intel.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Arjan Van De Ven <arjan@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>,
Vlastimil Babka <vbabka@suse.cz>,
David Hildenbrand <david@redhat.com>,
Johannes Weiner <jweiner@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Pavel Tatashin <pasha.tatashin@soleen.com>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [RFC 2/2] mm: alloc/free depth based PCP high auto-tuning
Date: Tue, 11 Jul 2023 13:19:46 +0200 [thread overview]
Message-ID: <ZK060sMG0GfC5gUS@dhcp22.suse.cz> (raw)
In-Reply-To: <20230710065325.290366-3-ying.huang@intel.com>
On Mon 10-07-23 14:53:25, Huang Ying wrote:
> To auto-tune PCP high for each CPU automatically, an
> allocation/freeing depth based PCP high auto-tuning algorithm is
> implemented in this patch.
>
> The basic idea behind the algorithm is to detect the repetitive
> allocation and freeing pattern with short enough period (about 1
> second). The period needs to be short to respond to allocation and
> freeing pattern changes quickly and control the memory wasted by
> unnecessary caching.
1s is an ethernity from the allocation POV. Is a time based sampling
really a good choice? I would have expected a natural allocation/freeing
feedback mechanism. I.e. double the batch size when the batch is
consumed and it requires to be refilled and shrink it under memory
pressure (GFP_NOWAIT allocation fails) or when the surplus grows too
high over batch (e.g. twice as much). Have you considered something as
simple as that?
Quite honestly I am not sure time based approach is a good choice
because memory consumptions tends to be quite bulky (e.g. application
starts or workload transitions based on requests).
> To detect the repetitive allocation and freeing pattern, the
> alloc/free depth is calculated for each tuning period (1 second) on
> each CPU. To calculate the alloc/free depth, we track the alloc
> count. Which increases for page allocation from PCP and decreases for
> page freeing to PCP. The alloc depth is the maximum alloc count
> difference between the later large value and former small value.
> While, the free depth is the maximum alloc count difference between
> the former large value and the later small value.
>
> Then, the average alloc/free depth in multiple tuning periods is
> calculated, with the old alloc/free depth decay in the average
> gradually.
>
> Finally, the PCP high is set to be the smaller value of average alloc
> depth and average free depth, after clamped between the default and
> the max PCP high. In this way, pure allocation or freeing will not
> enlarge the PCP high because PCP doesn't help.
>
> We have tested the algorithm with several workloads on Intel's
> 2-socket server machines.
How does this scheme deal with memory pressure?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-07-11 11:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 6:53 [RFC 0/2] mm: " Huang Ying
2023-07-10 6:53 ` [RFC 1/2] mm: add framework for " Huang Ying
2023-07-11 11:07 ` Michal Hocko
2023-07-12 7:45 ` Huang, Ying
2023-07-14 8:59 ` Michal Hocko
2023-07-17 8:19 ` Huang, Ying
2023-07-10 6:53 ` [RFC 2/2] mm: alloc/free depth based " Huang Ying
2023-07-11 11:19 ` Michal Hocko [this message]
2023-07-12 9:05 ` Mel Gorman
2023-07-13 8:56 ` Huang, Ying
2023-07-14 14:07 ` Mel Gorman
2023-07-17 9:16 ` Huang, Ying
2023-07-17 13:50 ` Mel Gorman
2023-07-18 0:55 ` Huang, Ying
2023-07-18 12:34 ` Mel Gorman
2023-07-19 5:59 ` Huang, Ying
2023-07-19 9:05 ` Mel Gorman
2023-07-21 7:28 ` Huang, Ying
2023-07-21 9:21 ` Mel Gorman
2023-07-24 1:09 ` Huang, Ying
2023-07-14 11:41 ` Michal Hocko
2023-07-13 8:11 ` Huang, Ying
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=ZK060sMG0GfC5gUS@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=jweiner@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=pasha.tatashin@soleen.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ying.huang@intel.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