* [PATCH v2 0/2] mm: print the promo watermark in zoneinfo @ 2024-08-01 23:25 kaiyang2 2024-08-01 23:25 ` [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites kaiyang2 2024-08-01 23:25 ` [PATCH v2 2/2] mm: print the promo watermark in zoneinfo kaiyang2 0 siblings, 2 replies; 6+ messages in thread From: kaiyang2 @ 2024-08-01 23:25 UTC (permalink / raw) To: linux-mm; +Cc: akpm, hannes, Kaiyang Zhao From: Kaiyang Zhao <kaiyang2@cs.cmu.edu> V1 -> V2: Added promo_wmark_pages and converted existing call sites as suggested. Kaiyang Zhao (2): mm: create promo_wmark_pages and clean up open-coded sites mm: print the promo watermark in zoneinfo include/linux/mmzone.h | 1 + kernel/sched/fair.c | 2 +- mm/vmscan.c | 2 +- mm/vmstat.c | 2 ++ 4 files changed, 5 insertions(+), 2 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites 2024-08-01 23:25 [PATCH v2 0/2] mm: print the promo watermark in zoneinfo kaiyang2 @ 2024-08-01 23:25 ` kaiyang2 2024-08-02 0:03 ` Andrew Morton 2024-08-01 23:25 ` [PATCH v2 2/2] mm: print the promo watermark in zoneinfo kaiyang2 1 sibling, 1 reply; 6+ messages in thread From: kaiyang2 @ 2024-08-01 23:25 UTC (permalink / raw) To: linux-mm; +Cc: akpm, hannes, Kaiyang Zhao From: Kaiyang Zhao <kaiyang2@cs.cmu.edu> Define promo_wmark_pages and convert current call sites of wmark_pages with fixed WMARK_PROMO to using it instead. Signed-off-by: Kaiyang Zhao <kaiyang2@cs.cmu.edu> --- include/linux/mmzone.h | 1 + kernel/sched/fair.c | 2 +- mm/vmscan.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 9f389c76581f..6ea22b3e2f30 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -671,6 +671,7 @@ enum zone_watermarks { #define min_wmark_pages(z) (z->_watermark[WMARK_MIN] + z->watermark_boost) #define low_wmark_pages(z) (z->_watermark[WMARK_LOW] + z->watermark_boost) #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) +#define promo_wmark_pages(z) (z->_watermark[WMARK_PROMO] + z->watermark_boost) #define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost) /* diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 416e29b56cc4..20ea6d085305 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1742,7 +1742,7 @@ static bool pgdat_free_space_enough(struct pglist_data *pgdat) continue; if (zone_watermark_ok(zone, 0, - wmark_pages(zone, WMARK_PROMO) + enough_wmark, + promo_wmark_pages(zone) + enough_wmark, ZONE_MOVABLE, 0)) return true; } diff --git a/mm/vmscan.c b/mm/vmscan.c index c89d0551655e..31d13462571e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6705,7 +6705,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int highest_zoneidx) continue; if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) - mark = wmark_pages(zone, WMARK_PROMO); + mark = promo_wmark_pages(zone); else mark = high_wmark_pages(zone); if (zone_watermark_ok_safe(zone, order, mark, highest_zoneidx)) -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites 2024-08-01 23:25 ` [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites kaiyang2 @ 2024-08-02 0:03 ` Andrew Morton 2024-08-02 1:31 ` Johannes Weiner 0 siblings, 1 reply; 6+ messages in thread From: Andrew Morton @ 2024-08-02 0:03 UTC (permalink / raw) To: kaiyang2; +Cc: linux-mm, hannes On Thu, 1 Aug 2024 23:25:47 +0000 kaiyang2@cs.cmu.edu wrote: > Define promo_wmark_pages and convert current call sites of wmark_pages > with fixed WMARK_PROMO to using it instead. Fair enough. I did a thing. From: Andrew Morton <akpm@linux-foundation.org> Subject: include/linux/mmzone.h: clean up watermark accessors Date: Thu Aug 1 04:50:05 PM PDT 2024 - we have a helper wmark_pages(). Teach min_wmark_pages(), low_wmark_pages(), high_wmark_pages() and promo_wmark_pages() to use it instead of open-coding its implementation. - there's no reason to implement all these things as macros. Redo them in C. Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kaiyang Zhao <kaiyang2@cs.cmu.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- include/linux/mmzone.h | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) --- a/include/linux/mmzone.h~include-linux-mmzoneh-clean-up-watermark-accessors +++ a/include/linux/mmzone.h @@ -668,12 +668,6 @@ enum zone_watermarks { #define NR_LOWORDER_PCP_LISTS (MIGRATE_PCPTYPES * (PAGE_ALLOC_COSTLY_ORDER + 1)) #define NR_PCP_LISTS (NR_LOWORDER_PCP_LISTS + NR_PCP_THP) -#define min_wmark_pages(z) (z->_watermark[WMARK_MIN] + z->watermark_boost) -#define low_wmark_pages(z) (z->_watermark[WMARK_LOW] + z->watermark_boost) -#define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) -#define promo_wmark_pages(z) (z->_watermark[WMARK_PROMO] + z->watermark_boost) -#define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost) - /* * Flags used in pcp->flags field. * @@ -1019,6 +1013,32 @@ enum zone_flags { ZONE_BELOW_HIGH, /* zone is below high watermark. */ }; +static inline unsigned long wmark_pages(const struct zone *z, + enum zone_watermarks w) +{ + return z->_watermark[w] + z->watermark_boost; +} + +static inline unsigned long min_wmark_pages(const struct zone *z) +{ + return wmark_pages(z, WMARK_MIN); +} + +static inline unsigned long low_wmark_pages(const struct zone *z) +{ + return wmark_pages(z, WMARK_LOW); +} + +static inline unsigned long high_wmark_pages(const struct zone *z) +{ + return wmark_pages(z, WMARK_HIGH); +} + +static inline unsigned long promo_wmark_pages(const struct zone *z) +{ + return wmark_pages(z, WMARK_PROMO); +} + static inline unsigned long zone_managed_pages(struct zone *zone) { return (unsigned long)atomic_long_read(&zone->managed_pages); _ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites 2024-08-02 0:03 ` Andrew Morton @ 2024-08-02 1:31 ` Johannes Weiner 0 siblings, 0 replies; 6+ messages in thread From: Johannes Weiner @ 2024-08-02 1:31 UTC (permalink / raw) To: Andrew Morton; +Cc: kaiyang2, linux-mm On Thu, Aug 01, 2024 at 05:03:02PM -0700, Andrew Morton wrote: > On Thu, 1 Aug 2024 23:25:47 +0000 kaiyang2@cs.cmu.edu wrote: > > > Define promo_wmark_pages and convert current call sites of wmark_pages > > with fixed WMARK_PROMO to using it instead. > > Fair enough. I did a thing. > > From: Andrew Morton <akpm@linux-foundation.org> > Subject: include/linux/mmzone.h: clean up watermark accessors > Date: Thu Aug 1 04:50:05 PM PDT 2024 > > - we have a helper wmark_pages(). Teach min_wmark_pages(), > low_wmark_pages(), high_wmark_pages() and promo_wmark_pages() to use > it instead of open-coding its implementation. > > - there's no reason to implement all these things as macros. Redo them > in C. > > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: Kaiyang Zhao <kaiyang2@cs.cmu.edu> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Johannes Weiner <hannes@cmpxchg.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] mm: print the promo watermark in zoneinfo 2024-08-01 23:25 [PATCH v2 0/2] mm: print the promo watermark in zoneinfo kaiyang2 2024-08-01 23:25 ` [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites kaiyang2 @ 2024-08-01 23:25 ` kaiyang2 2024-08-01 23:48 ` Andrew Morton 1 sibling, 1 reply; 6+ messages in thread From: kaiyang2 @ 2024-08-01 23:25 UTC (permalink / raw) To: linux-mm; +Cc: akpm, hannes, Kaiyang Zhao From: Kaiyang Zhao <kaiyang2@cs.cmu.edu> Printing the promo watermark in zoneinfo just like other watermarks. This helps users check and verify all the watermarks are appropriate. Signed-off-by: Kaiyang Zhao <kaiyang2@cs.cmu.edu> --- mm/vmstat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index 5082431dad28..4e2dc067a654 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1725,6 +1725,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, "\n min %lu" "\n low %lu" "\n high %lu" + "\n promo %lu" "\n spanned %lu" "\n present %lu" "\n managed %lu" @@ -1734,6 +1735,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, min_wmark_pages(zone), low_wmark_pages(zone), high_wmark_pages(zone), + promo_wmark_pages(zone), zone->spanned_pages, zone->present_pages, zone_managed_pages(zone), -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] mm: print the promo watermark in zoneinfo 2024-08-01 23:25 ` [PATCH v2 2/2] mm: print the promo watermark in zoneinfo kaiyang2 @ 2024-08-01 23:48 ` Andrew Morton 0 siblings, 0 replies; 6+ messages in thread From: Andrew Morton @ 2024-08-01 23:48 UTC (permalink / raw) To: kaiyang2; +Cc: linux-mm, hannes On Thu, 1 Aug 2024 23:25:48 +0000 kaiyang2@cs.cmu.edu wrote: > From: Kaiyang Zhao <kaiyang2@cs.cmu.edu> > > Printing the promo watermark in zoneinfo just like other watermarks. > This helps users check and verify all the watermarks are appropriate. > Well, I guess for a two-liner I'll let it go, but it would be better to tell us *why* it "helps users", rather than providing an unsupported assertion such as this. In what scenarios has this proven useful? Details, details, details - spare us none. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-08-02 1:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-08-01 23:25 [PATCH v2 0/2] mm: print the promo watermark in zoneinfo kaiyang2 2024-08-01 23:25 ` [PATCH v2 1/2] mm: create promo_wmark_pages and clean up open-coded sites kaiyang2 2024-08-02 0:03 ` Andrew Morton 2024-08-02 1:31 ` Johannes Weiner 2024-08-01 23:25 ` [PATCH v2 2/2] mm: print the promo watermark in zoneinfo kaiyang2 2024-08-01 23:48 ` Andrew Morton
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox