mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
shmem: mapping_set_exiting() to help mapped resilience
When I added page_mapped() resilience in __delete_from_page_cache() for
the mapping_exiting() case, I missed that mapping_set_exiting() is done
in truncate_inode_pages_final(), which is not actually called for shmem.
(Today, it is folio_mapped() resilience in filemap_unaccount_folio().)
So the fixup to avoid a memory leak in this case never worked on shmem:
add a mapping_set_exiting() in shmem_evict_inode() at last. But this is
hardly a candidate for stable, since it's only useful if "Bad page".
Link: https://lkml.kernel.org/r/beefffda-6326-e36d-2d41-ed15b51af872@google.com
Fixes: 06b241f32c
("mm: __delete_from_page_cache show Bad page if mapped")
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f7cd16a558
commit
bc7863906f
@ -1129,6 +1129,7 @@ static void shmem_evict_inode(struct inode *inode)
|
|||||||
if (shmem_mapping(inode->i_mapping)) {
|
if (shmem_mapping(inode->i_mapping)) {
|
||||||
shmem_unacct_size(info->flags, inode->i_size);
|
shmem_unacct_size(info->flags, inode->i_size);
|
||||||
inode->i_size = 0;
|
inode->i_size = 0;
|
||||||
|
mapping_set_exiting(inode->i_mapping);
|
||||||
shmem_truncate_range(inode, 0, (loff_t)-1);
|
shmem_truncate_range(inode, 0, (loff_t)-1);
|
||||||
if (!list_empty(&info->shrinklist)) {
|
if (!list_empty(&info->shrinklist)) {
|
||||||
spin_lock(&sbinfo->shrinklist_lock);
|
spin_lock(&sbinfo->shrinklist_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user