* [PATCH 1/3] shmem: fix tmpfs to handle the huge= option properly
[not found] <alpine.LSU.2.11.1609232014130.2495@eggly.anvils>
@ 2016-09-24 3:21 ` Hugh Dickins
2016-09-24 3:24 ` [PATCH 2/3] huge tmpfs: fix Committed_AS leak Hugh Dickins
2016-09-24 3:27 ` [PATCH 3/3] mm: delete unnecessary and unsafe init_tlb_ubc() Hugh Dickins
2 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2016-09-24 3:21 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, Toshi Kani, Hillf Danton, Kirill A. Shutemov,
Aneesh Kumar K.V, linux-kernel, linux-mm
From: Toshi Kani <toshi.kani@hpe.com>
shmem_get_unmapped_area() checks SHMEM_SB(sb)->huge incorrectly,
which leads to a reversed effect of "huge=" mount option.
Fix the check in shmem_get_unmapped_area().
Note, the default value of SHMEM_SB(sb)->huge remains as
SHMEM_HUGE_NEVER. User will need to specify "huge=" option to
enable huge page mappings.
Reported-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
---
mm/shmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 4.8-rc7/mm/shmem.c 2016-08-14 20:17:02.388843463 -0700
+++ linux/mm/shmem.c 2016-09-22 19:41:29.057848626 -0700
@@ -1980,7 +1980,7 @@ unsigned long shmem_get_unmapped_area(st
return addr;
sb = shm_mnt->mnt_sb;
}
- if (SHMEM_SB(sb)->huge != SHMEM_HUGE_NEVER)
+ if (SHMEM_SB(sb)->huge == SHMEM_HUGE_NEVER)
return addr;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] huge tmpfs: fix Committed_AS leak
[not found] <alpine.LSU.2.11.1609232014130.2495@eggly.anvils>
2016-09-24 3:21 ` [PATCH 1/3] shmem: fix tmpfs to handle the huge= option properly Hugh Dickins
@ 2016-09-24 3:24 ` Hugh Dickins
2016-09-24 3:27 ` [PATCH 3/3] mm: delete unnecessary and unsafe init_tlb_ubc() Hugh Dickins
2 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2016-09-24 3:24 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, Kirill A. Shutemov, linux-kernel, linux-mm
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.
Fixes: 800d8c63b2e9 ("shmem: add huge pages support")
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
mm/shmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- 4.8-rc7/mm/shmem.c 2016-08-14 20:17:02.388843463 -0700
+++ linux/mm/shmem.c 2016-09-22 09:29:15.462690346 -0700
@@ -270,7 +270,7 @@ bool shmem_charge(struct inode *inode, l
info->alloced -= pages;
shmem_recalc_inode(inode);
spin_unlock_irqrestore(&info->lock, flags);
-
+ shmem_unacct_blocks(info->flags, pages);
return false;
}
percpu_counter_add(&sbinfo->used_blocks, pages);
@@ -291,6 +291,7 @@ void shmem_uncharge(struct inode *inode,
if (sbinfo->max_blocks)
percpu_counter_sub(&sbinfo->used_blocks, pages);
+ shmem_unacct_blocks(info->flags, pages);
}
/*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] mm: delete unnecessary and unsafe init_tlb_ubc()
[not found] <alpine.LSU.2.11.1609232014130.2495@eggly.anvils>
2016-09-24 3:21 ` [PATCH 1/3] shmem: fix tmpfs to handle the huge= option properly Hugh Dickins
2016-09-24 3:24 ` [PATCH 2/3] huge tmpfs: fix Committed_AS leak Hugh Dickins
@ 2016-09-24 3:27 ` Hugh Dickins
2 siblings, 0 replies; 3+ messages in thread
From: Hugh Dickins @ 2016-09-24 3:27 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Andrew Morton, Mel Gorman, linux-kernel, linux-mm
init_tlb_ubc() looked unnecessary to me: tlb_ubc is statically initialized
with zeroes in the init_task, and copied from parent to child while it is
quiescent in arch_dup_task_struct(); so I went to delete it.
But inserted temporary debug WARN_ONs in place of init_tlb_ubc() to check
that it was always empty at that point, and found them firing: because
memcg reclaim can recurse into global reclaim (when allocating biosets
for swapout in my case), and arrive back at the init_tlb_ubc() in
shrink_node_memcg().
Resetting tlb_ubc.flush_required at that point is wrong: if the upper
level needs a deferred TLB flush, but the lower level turns out not to,
we miss a TLB flush. But fortunately, that's the only part of the
protocol that does not nest: with the initialization removed, cpumask
collects bits from upper and lower levels, and flushes TLB when needed.
Fixes: 72b252aed506 ("mm: send one IPI per CPU to TLB flush all entries after unmapping pages")
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: stable@vger.kernel.org # 4.3+
---
mm/vmscan.c | 19 -------------------
1 file changed, 19 deletions(-)
--- 4.8-rc7/mm/vmscan.c 2016-09-05 16:42:52.496692429 -0700
+++ linux/mm/vmscan.c 2016-09-22 09:32:37.900894833 -0700
@@ -2303,23 +2303,6 @@ out:
}
}
-#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
-static void init_tlb_ubc(void)
-{
- /*
- * This deliberately does not clear the cpumask as it's expensive
- * and unnecessary. If there happens to be data in there then the
- * first SWAP_CLUSTER_MAX pages will send an unnecessary IPI and
- * then will be cleared.
- */
- current->tlb_ubc.flush_required = false;
-}
-#else
-static inline void init_tlb_ubc(void)
-{
-}
-#endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */
-
/*
* This is a basic per-node page freer. Used by both kswapd and direct reclaim.
*/
@@ -2355,8 +2338,6 @@ static void shrink_node_memcg(struct pgl
scan_adjusted = (global_reclaim(sc) && !current_is_kswapd() &&
sc->priority == DEF_PRIORITY);
- init_tlb_ubc();
-
blk_start_plug(&plug);
while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||
nr[LRU_INACTIVE_FILE]) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-24 3:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <alpine.LSU.2.11.1609232014130.2495@eggly.anvils>
2016-09-24 3:21 ` [PATCH 1/3] shmem: fix tmpfs to handle the huge= option properly Hugh Dickins
2016-09-24 3:24 ` [PATCH 2/3] huge tmpfs: fix Committed_AS leak Hugh Dickins
2016-09-24 3:27 ` [PATCH 3/3] mm: delete unnecessary and unsafe init_tlb_ubc() Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).