Skip to contentSkip to conversation

mm: page_alloc: set sysctl_lowmem_reserve_ratio storage-class-specifier to static

PATCH Applied Tom Rix 2 participants 2 messages May 18, 2023 – May 19, 2023

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 mm: page_alloc: set sysctl_lowmem_reserve_ratio storage-class-specifier to static

smatch reports
mm/page_alloc.c:247:5: warning: symbol
'sysctl_lowmem_reserve_ratio' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static

---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
index 1023f41de2fb..8032fffa425a 100644
@@ -244,7 +244,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
  * TBD: should special case ZONE_DMA32 machines here - in those we normally
  * don't need any ZONE_NORMAL reservation
  */
-int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
+static int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
 #ifdef CONFIG_ZONE_DMA
 	[ZONE_DMA] = 256,
 #endif
Signature · 1 line
2.27.0
#1 lore raw
Quoted 11 lines · Tom Rix

smatch reports
mm/page_alloc.c:247:5: warning: symbol
'sysctl_lowmem_reserve_ratio' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static

---
  mm/page_alloc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Missing this one, Reviewed-by: Kefeng Wang <[email protected]>

Quoted 13 lines
mm/page_alloc.c +1 -1
index 1023f41de2fb..8032fffa425a 100644
@@ -244,7 +244,7 @@ static void __free_pages_ok(struct page *page, unsigned int order,
   * TBD: should special case ZONE_DMA32 machines here - in those we normally
   * don't need any ZONE_NORMAL reservation
   */
-int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
+static int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
  #ifdef CONFIG_ZONE_DMA
  	[ZONE_DMA] = 256,
  #endif