* Re: [PATCH RFC] delayacct: add memory reclaim delay in get_page_from_freelist [not found] ` <SH0PR01MB0587E4A7886C9642CCF1F8DBC1E5A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn> @ 2023-09-02 23:44 ` Andrew Morton [not found] ` <SH0PR01MB0587592CA2974791B177BFA4C1E8A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn> 0 siblings, 1 reply; 2+ messages in thread From: Andrew Morton @ 2023-09-02 23:44 UTC (permalink / raw) To: liwenyu01; +Cc: linux-mm, linux-kernel, wangyun On Thu, 31 Aug 2023 07:26:20 +0000 "liwenyu01@bilibili.com" <liwenyu01@bilibili.com> wrote: > reclaim of the task in do_try_to_free_pages(). In systems with NUMA > open, some tasks occasionally experience slower response times, but the > total count of reclaim does not increase, using ftrace can show that > node_reclaim has occurred. > > The memory reclaim occurring in get_page_from_freelist() is also due to > heavy memory load. To get the impact of tasks in memory reclaim, this > patch adds the statistics of the memory reclaim delay statistics for > __node_reclaim(). > > ... > > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -8010,6 +8010,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in > > cond_resched(); > psi_memstall_enter(&pflags); > + delayacct_freepages_start(); > fs_reclaim_acquire(sc.gfp_mask); > /* > * We need to be able to allocate from the reserves for RECLAIM_UNMAP > @@ -8032,6 +8033,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in > memalloc_noreclaim_restore(noreclaim_flag); > fs_reclaim_release(sc.gfp_mask); > psi_memstall_leave(&pflags); > + delayacct_freepages_end(); > > trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed); __node_reclaim() calls shrink_node() which at some point will call do_try_to_free_pages() (yes?), which calls delayacct_freepages_start(). So we're effectively nesting calls to delayacct_freepages_start(), which isn't designed for that? ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <SH0PR01MB0587592CA2974791B177BFA4C1E8A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn>]
* Re: [PATCH RFC] delayacct: add memory reclaim delay in get_page_from_freelist [not found] ` <SH0PR01MB0587592CA2974791B177BFA4C1E8A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn> @ 2023-09-06 0:53 ` Education Directorate 0 siblings, 0 replies; 2+ messages in thread From: Education Directorate @ 2023-09-06 0:53 UTC (permalink / raw) To: liwenyu01; +Cc: akpm, linux-mm, linux-kernel, wangyun On Tue, Sep 05, 2023 at 05:32:15AM +0000, liwenyu01@bilibili.com wrote: > >> reclaim of the task in do_try_to_free_pages(). In systems with NUMA > >> open, some tasks occasionally experience slower response times, but the > >> total count of reclaim does not increase, using ftrace can show that > >> node_reclaim has occurred. > >> > >> The memory reclaim occurring in get_page_from_freelist() is also due to > >> heavy memory load. To get the impact of tasks in memory reclaim, this > >> patch adds the statistics of the memory reclaim delay statistics for > >> __node_reclaim(). > >> > >> ... > >> > >> --- a/mm/vmscan.c > >> +++ b/mm/vmscan.c > >> @@ -8010,6 +8010,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in > >> > >> cond_resched(); > >> psi_memstall_enter(&pflags); > >> + delayacct_freepages_start(); > >> fs_reclaim_acquire(sc.gfp_mask); > >> /* > >> * We need to be able to allocate from the reserves for RECLAIM_UNMAP > >> @@ -8032,6 +8033,7 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in > >> memalloc_noreclaim_restore(noreclaim_flag); > >> fs_reclaim_release(sc.gfp_mask); > >> psi_memstall_leave(&pflags); > >> + delayacct_freepages_end(); > >> > >> trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed); > > > > __node_reclaim() calls shrink_node() which at some point will call > > do_try_to_free_pages() (yes?), which calls delayacct_freepages_start(). > > > > So we're effectively nesting calls to delayacct_freepages_start(), > > which isn't designed for that? > > > sorry, the last reply was a mistake. > > It seems that no point in shrink_node() will call do_try_to_free_pages(). > And do_try_to_free_pages() will call shrink_node() through shrink_zones(), > if shrink_node() also has some point will call do_try_to_free_pages,then > delayacct_freepages_start() is nested now? That's because shrink_node() goes through shrink_list() via shrink_lruvec()? do_try_to_free_pages() will call shrink_node(). Ideally we should have some counters around __node_reclaim() and balance_pgdat() like psi_memstall_* does. Do you want to mimic what psi_memstall_* does? This would change the definition of delayacct free pages, but I don't think it will make it worse. Balbir Singh ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-06 0:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <SH0PR01MB058780B26AB21BEB8E76B6BBC11CA@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn>
[not found] ` <SH0PR01MB0587E4A7886C9642CCF1F8DBC1E5A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn>
2023-09-02 23:44 ` [PATCH RFC] delayacct: add memory reclaim delay in get_page_from_freelist Andrew Morton
[not found] ` <SH0PR01MB0587592CA2974791B177BFA4C1E8A@SH0PR01MB0587.CHNPR01.prod.partner.outlook.cn>
2023-09-06 0:53 ` Education Directorate
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®