]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/vmstat.c
net_sched: fix a memory leak in atm_tc_init()
[mirror_ubuntu-jammy-kernel.git] / mm / vmstat.c
index 5e241434cab28887d55f4f66a65a13656848c234..3fb23a21f6dd6cb6b2a663b607a511e172a8da19 100644 (file)
@@ -76,7 +76,7 @@ static void invalid_numa_statistics(void)
 static DEFINE_MUTEX(vm_numa_stat_lock);
 
 int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,
-               void __user *buffer, size_t *length, loff_t *ppos)
+               void *buffer, size_t *length, loff_t *ppos)
 {
        int ret, oldval;
 
@@ -1203,6 +1203,10 @@ const char * const vmstat_text[] = {
        "pgscan_kswapd",
        "pgscan_direct",
        "pgscan_direct_throttle",
+       "pgscan_anon",
+       "pgscan_file",
+       "pgsteal_anon",
+       "pgsteal_file",
 
 #ifdef CONFIG_NUMA
        "zone_reclaim_failed",
@@ -1592,6 +1596,12 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                   zone->present_pages,
                   zone_managed_pages(zone));
 
+       /* If unpopulated, no other information is useful */
+       if (!populated_zone(zone)) {
+               seq_putc(m, '\n');
+               return;
+       }
+
        seq_printf(m,
                   "\n        protection: (%ld",
                   zone->lowmem_reserve[0]);
@@ -1599,12 +1609,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                seq_printf(m, ", %ld", zone->lowmem_reserve[i]);
        seq_putc(m, ')');
 
-       /* If unpopulated, no other information is useful */
-       if (!populated_zone(zone)) {
-               seq_putc(m, '\n');
-               return;
-       }
-
        for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
                seq_printf(m, "\n      %-12s %lu", zone_stat_name(i),
                           zone_page_state(zone, i));
@@ -1761,7 +1765,7 @@ static void refresh_vm_stats(struct work_struct *work)
 }
 
 int vmstat_refresh(struct ctl_table *table, int write,
-                  void __user *buffer, size_t *lenp, loff_t *ppos)
+                  void *buffer, size_t *lenp, loff_t *ppos)
 {
        long val;
        int err;
@@ -2065,24 +2069,14 @@ static int unusable_show(struct seq_file *m, void *arg)
        return 0;
 }
 
-static const struct seq_operations unusable_op = {
+static const struct seq_operations unusable_sops = {
        .start  = frag_start,
        .next   = frag_next,
        .stop   = frag_stop,
        .show   = unusable_show,
 };
 
-static int unusable_open(struct inode *inode, struct file *file)
-{
-       return seq_open(file, &unusable_op);
-}
-
-static const struct file_operations unusable_file_ops = {
-       .open           = unusable_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = seq_release,
-};
+DEFINE_SEQ_ATTRIBUTE(unusable);
 
 static void extfrag_show_print(struct seq_file *m,
                                        pg_data_t *pgdat, struct zone *zone)
@@ -2117,24 +2111,14 @@ static int extfrag_show(struct seq_file *m, void *arg)
        return 0;
 }
 
-static const struct seq_operations extfrag_op = {
+static const struct seq_operations extfrag_sops = {
        .start  = frag_start,
        .next   = frag_next,
        .stop   = frag_stop,
        .show   = extfrag_show,
 };
 
-static int extfrag_open(struct inode *inode, struct file *file)
-{
-       return seq_open(file, &extfrag_op);
-}
-
-static const struct file_operations extfrag_file_ops = {
-       .open           = extfrag_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = seq_release,
-};
+DEFINE_SEQ_ATTRIBUTE(extfrag);
 
 static int __init extfrag_debug_init(void)
 {
@@ -2143,10 +2127,10 @@ static int __init extfrag_debug_init(void)
        extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
 
        debugfs_create_file("unusable_index", 0444, extfrag_debug_root, NULL,
-                           &unusable_file_ops);
+                           &unusable_fops);
 
        debugfs_create_file("extfrag_index", 0444, extfrag_debug_root, NULL,
-                           &extfrag_file_ops);
+                           &extfrag_fops);
 
        return 0;
 }