diff for duplicates of <20170814012617.GB25427@bbox> diff --git a/a/1.txt b/N1/1.txt index cf21fc7..09b69f6 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -22,69 +22,3 @@ On Fri, Aug 11, 2017 at 03:30:20PM +0200, Peter Zijlstra wrote: > the increment if we need to? How about this about commenting part? - -From 05f06fd6aba14447a9ca2df8b810fbcf9a58e14b Mon Sep 17 00:00:00 2001 -From: Minchan Kim <minchan@kernel.org> -Date: Mon, 14 Aug 2017 10:16:56 +0900 -Subject: [PATCH] mm: add describable comment for TLB batch race - -[1] is a rather subtle/complicated bug so that it's hard to -understand it with limited code comment. - -This patch adds a sequence diagaram to explain the problem -more easily, I hope. - -[1] 99baac21e458, mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem - -Cc: Peter Zijlstra <peterz@infradead.org> -Cc: Nadav Amit <namit@vmware.com> -Cc: Mel Gorman <mgorman@techsingularity.net> -Signed-off-by: Minchan Kim <minchan@kernel.org> ---- - mm/memory.c | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -diff --git a/mm/memory.c b/mm/memory.c -index bcbe56f52163..f571b0eb9816 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -413,12 +413,37 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, - void tlb_finish_mmu(struct mmu_gather *tlb, - unsigned long start, unsigned long end) - { -+ -+ - /* - * If there are parallel threads are doing PTE changes on same range - * under non-exclusive lock(e.g., mmap_sem read-side) but defer TLB - * flush by batching, a thread has stable TLB entry can fail to flush - * the TLB by observing pte_none|!pte_dirty, for example so flush TLB - * forcefully if we detect parallel PTE batching threads. -+ * -+ * Example: MADV_DONTNEED stale TLB problem on same range -+ * -+ * CPU 0 CPU 1 -+ * *a = 1; -+ * MADV_DONTNEED -+ * MADV_DONTNEED tlb_gather_mmu -+ * tlb_gather_mmu -+ * down_read(mmap_sem) down_read(mmap_sem) -+ * pte_lock -+ * pte_get_and_clear -+ * tlb_remove_tlb_entry -+ * pte_unlock -+ * pte_lock -+ * found out the pte is none -+ * pte_unlock -+ * tlb_finish_mmu doesn't flush -+ * -+ * Access the address with stale TLB -+ * *a = 2;ie, success without segfault -+ * tlb_finish_mmu flush on range -+ * but it is too late. -+ * - */ - bool force = mm_tlb_flush_nested(tlb->mm); - --- -2.7.4 diff --git a/a/content_digest b/N1/content_digest index 5e2457e..e6272c6 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -44,72 +44,6 @@ "> I don't understand the comment nor the ordering. What guarantees we see\n" "> the increment if we need to?\n" "\n" - "How about this about commenting part?\n" - "\n" - "From 05f06fd6aba14447a9ca2df8b810fbcf9a58e14b Mon Sep 17 00:00:00 2001\n" - "From: Minchan Kim <minchan@kernel.org>\n" - "Date: Mon, 14 Aug 2017 10:16:56 +0900\n" - "Subject: [PATCH] mm: add describable comment for TLB batch race\n" - "\n" - "[1] is a rather subtle/complicated bug so that it's hard to\n" - "understand it with limited code comment.\n" - "\n" - "This patch adds a sequence diagaram to explain the problem\n" - "more easily, I hope.\n" - "\n" - "[1] 99baac21e458, mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem\n" - "\n" - "Cc: Peter Zijlstra <peterz@infradead.org>\n" - "Cc: Nadav Amit <namit@vmware.com>\n" - "Cc: Mel Gorman <mgorman@techsingularity.net>\n" - "Signed-off-by: Minchan Kim <minchan@kernel.org>\n" - "---\n" - " mm/memory.c | 25 +++++++++++++++++++++++++\n" - " 1 file changed, 25 insertions(+)\n" - "\n" - "diff --git a/mm/memory.c b/mm/memory.c\n" - "index bcbe56f52163..f571b0eb9816 100644\n" - "--- a/mm/memory.c\n" - "+++ b/mm/memory.c\n" - "@@ -413,12 +413,37 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,\n" - " void tlb_finish_mmu(struct mmu_gather *tlb,\n" - " \t\tunsigned long start, unsigned long end)\n" - " {\n" - "+\n" - "+\n" - " \t/*\n" - " \t * If there are parallel threads are doing PTE changes on same range\n" - " \t * under non-exclusive lock(e.g., mmap_sem read-side) but defer TLB\n" - " \t * flush by batching, a thread has stable TLB entry can fail to flush\n" - " \t * the TLB by observing pte_none|!pte_dirty, for example so flush TLB\n" - " \t * forcefully if we detect parallel PTE batching threads.\n" - "+\t *\n" - "+\t * Example: MADV_DONTNEED stale TLB problem on same range\n" - "+\t *\n" - "+\t * CPU 0\t\t\t\tCPU 1\n" - "+\t * *a = 1;\n" - "+\t *\t\t\t\t\tMADV_DONTNEED\n" - "+\t * MADV_DONTNEED\t\t\ttlb_gather_mmu\n" - "+\t * tlb_gather_mmu\n" - "+\t * down_read(mmap_sem)\t\t\tdown_read(mmap_sem)\n" - "+\t *\t\t\t\t\tpte_lock\n" - "+\t *\t\t\t\t\tpte_get_and_clear\n" - "+\t *\t\t\t\t\ttlb_remove_tlb_entry\n" - "+\t *\t\t\t\t\tpte_unlock\n" - "+\t * pte_lock\n" - "+\t * found out the pte is none\n" - "+\t * pte_unlock\n" - "+\t * tlb_finish_mmu doesn't flush\n" - "+\t *\n" - "+\t * Access the address with stale TLB\n" - "+\t * *a = 2;ie, success without segfault\n" - "+\t *\t\t\t\t\ttlb_finish_mmu flush on range\n" - "+\t *\t\t\t\t\tbut it is too late.\n" - "+\t *\n" - " \t */\n" - " \tbool force = mm_tlb_flush_nested(tlb->mm);\n" - " \n" - "-- \n" - 2.7.4 + How about this about commenting part? -3ab6e306e9de206fd700710b71977cc56fb3cf0e39d555fc3094689076665829 +1eb7057019e1b0d82871e765f2f63e7065d37a9bf6d6381e06a0d07d3adb8ff5
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox