History

huge tmpfs: fix Committed_AS leak

Under swapping load on huge tmpfs, /proc/meminfo's Committed_AS grows bigger and bigger: just a cosmetic issue for most users, but disabling for those who run without overcommit (/proc/sys/vm/overcommit_memory 2). shmem_uncharge() was forgetting to unaccount __vm_enough_memory's charge, and shmem_charge() was forgetting it on the filesystem-full error path.

Hugh Dickins committed 10 years ago

Commit 71664661 parent 3089bf61 file · +2 −1Browse files

Unified · Split

mm/shmem.c+2−1
@@ -270,7 +270,7 @@ bool shmem_charge(struct inode *inode, long pages) · 269 unmodified lines
270 info->alloced -= pages;270 info->alloced -= pages;
271 shmem_recalc_inode(inode);271 shmem_recalc_inode(inode);
272 spin_unlock_irqrestore(&info->lock, flags);272 spin_unlock_irqrestore(&info->lock, flags);
273 273 shmem_unacct_blocks(info->flags, pages);
274 return false;274 return false;
275 }275 }
276 percpu_counter_add(&sbinfo->used_blocks, pages);276 percpu_counter_add(&sbinfo->used_blocks, pages);
@@ -291,6 +291,7 @@ void shmem_uncharge(struct inode *inode, long pages) · 14 unmodified lines
291 291
292 if (sbinfo->max_blocks)292 if (sbinfo->max_blocks)
293 percpu_counter_sub(&sbinfo->used_blocks, pages);293 percpu_counter_sub(&sbinfo->used_blocks, pages);
294 shmem_unacct_blocks(info->flags, pages);
294}295}
295 296
296/*297/*