Advertisement
arter97

Untitled

Jul 9th, 2019
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.25 KB | None | 0 0
  1. commit e09799ef03276b05ff2afec0e9a41f640ee6fae2
  2. Author: Park Ju Hyung <qkrwngud825@gmail.com>
  3. Date:   Tue Jul 9 16:15:31 2019 +0900
  4.  
  5.     alloc_stats: add reset
  6.    
  7.     Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
  8.  
  9. diff --git a/mm/alloc_stats.c b/mm/alloc_stats.c
  10. index d5f6fced27dd..c1940ba44075 100644
  11. --- a/mm/alloc_stats.c
  12. +++ b/mm/alloc_stats.c
  13. @@ -121,9 +121,31 @@ static int alloc_stats_open(struct inode *inode, struct file *file)
  14.     return single_open(file, alloc_stats_show, NULL);
  15.  }
  16.  
  17. +static ssize_t alloc_stats_write(struct file *filp, const char __user *ubuf,
  18. +                size_t len, loff_t *ppos)
  19. +{
  20. +   // Do nothing but reset counters at the moment
  21. +   unsigned long flags;
  22. +   int i, count;
  23. +
  24. +   spin_lock_irqsave(&stats_lock, flags);
  25. +   count = ARRAY_SIZE(alloc_stats_g);
  26. +
  27. +   for (i = 0; i < count; i++) {
  28. +       struct alloc_stats *stats = alloc_stats_g + i;
  29. +
  30. +       atomic_set(&stats->freed_samefunc, 0);
  31. +       atomic_set(&stats->count, 0);
  32. +   }
  33. +   spin_unlock_irqrestore(&stats_lock, flags);
  34. +
  35. +   return len;
  36. +}
  37. +
  38.  static const struct file_operations alloc_stats_fops = {
  39.     .owner = THIS_MODULE,
  40.     .open = alloc_stats_open,
  41. +   .write = alloc_stats_write,
  42.     .read = seq_read,
  43.     .llseek = seq_lseek,
  44.     .release = single_release
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement