Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1710617 > unrolled thread
| Started by | Minchan Kim <minchan@kernel.org> |
|---|---|
| First post | 2017-08-14 05:10 +0200 |
| Last post | 2017-08-14 21:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: linux-next: manual merge of the akpm-current tree with the tip tree Minchan Kim <minchan@kernel.org> - 2017-08-14 05:10 +0200
Re: linux-next: manual merge of the akpm-current tree with the tip tree Peter Zijlstra <peterz@infradead.org> - 2017-08-14 21:00 +0200
| From | Minchan Kim <minchan@kernel.org> |
|---|---|
| Date | 2017-08-14 05:10 +0200 |
| Subject | Re: linux-next: manual merge of the akpm-current tree with the tip tree |
| Message-ID | <uedVn-7ex-1@gated-at.bofh.it> |
Hi Peter,
On Fri, Aug 11, 2017 at 04:04:50PM +0200, Peter Zijlstra wrote:
>
> Ok, so I have the below to still go on-top.
>
> Ideally someone would clarify the situation around
> mm_tlb_flush_nested(), because ideally we'd remove the
> smp_mb__after_atomic() and go back to relying on PTL alone.
>
> This also removes the pointless smp_mb__before_atomic()
I'm not an expert of barrier stuff but IIUC, mm_tlb_flush_nested's
side full memory barrier can go with removing smp_mb__after_atomic
in inc_tlb_flush_pending side?
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 490af494c2da..5ad0e66df363 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -544,7 +544,12 @@ static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
*/
static inline bool mm_tlb_flush_nested(struct mm_struct *mm)
{
- return atomic_read(&mm->tlb_flush_pending) > 1;
+ /*
+ * atomic_dec_and_test's full memory barrier guarantees
+ * to see uptodate tlb_flush_pending count in other CPU
+ * without relying on page table lock.
+ */
+ return !atomic_dec_and_test(&mm->tlb_flush_pending);
}
static inline void init_tlb_flush_pending(struct mm_struct *mm)
diff --git a/mm/memory.c b/mm/memory.c
index f571b0eb9816..e90b57bc65fb 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -407,6 +407,10 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
unsigned long start, unsigned long end)
{
arch_tlb_gather_mmu(tlb, mm, start, end);
+ /*
+ * couterpart is mm_tlb_flush_nested in tlb_finish_mmu
+ * which decreases pending count.
+ */
inc_tlb_flush_pending(tlb->mm);
}
@@ -446,9 +450,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb,
*
*/
bool force = mm_tlb_flush_nested(tlb->mm);
-
arch_tlb_finish_mmu(tlb, start, end, force);
- dec_tlb_flush_pending(tlb->mm);
}
/*
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-08-14 21:00 +0200 |
| Message-ID | <uesKJ-7KO-5@gated-at.bofh.it> |
| In reply to | #1710617 |
On Mon, Aug 14, 2017 at 12:09:14PM +0900, Minchan Kim wrote: > @@ -446,9 +450,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb, > * > */ > bool force = mm_tlb_flush_nested(tlb->mm); > - > arch_tlb_finish_mmu(tlb, start, end, force); > - dec_tlb_flush_pending(tlb->mm); > } No, I think this breaks all the mm_tlb_flush_pending() users. They need the decrement to not be visible until the TLB flush is complete.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web