1. 27 7月, 2016 1 次提交
  2. 26 4月, 2014 1 次提交
    • L
      mm: split 'tlb_flush_mmu()' into tlb flushing and memory freeing parts · 1cf35d47
      Linus Torvalds 提交于
      The mmu-gather operation 'tlb_flush_mmu()' has done two things: the
      actual tlb flush operation, and the batched freeing of the pages that
      the TLB entries pointed at.
      
      This splits the operation into separate phases, so that the forced
      batched flushing done by zap_pte_range() can now do the actual TLB flush
      while still holding the page table lock, but delay the batched freeing
      of all the pages to after the lock has been dropped.
      
      This in turn allows us to avoid a race condition between
      set_page_dirty() (as called by zap_pte_range() when it finds a dirty
      shared memory pte) and page_mkclean(): because we now flush all the
      dirty page data from the TLB's while holding the pte lock,
      page_mkclean() will be held up walking the (recently cleaned) page
      tables until after the TLB entries have been flushed from all CPU's.
      Reported-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Tested-by: NDave Hansen <dave.hansen@intel.com>
      Acked-by: NHugh Dickins <hughd@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1cf35d47
  3. 16 8月, 2013 1 次提交
    • L
      Fix TLB gather virtual address range invalidation corner cases · 2b047252
      Linus Torvalds 提交于
      Ben Tebulin reported:
      
       "Since v3.7.2 on two independent machines a very specific Git
        repository fails in 9/10 cases on git-fsck due to an SHA1/memory
        failures.  This only occurs on a very specific repository and can be
        reproduced stably on two independent laptops.  Git mailing list ran
        out of ideas and for me this looks like some very exotic kernel issue"
      
      and bisected the failure to the backport of commit 53a59fc6 ("mm:
      limit mmu_gather batching to fix soft lockups on !CONFIG_PREEMPT").
      
      That commit itself is not actually buggy, but what it does is to make it
      much more likely to hit the partial TLB invalidation case, since it
      introduces a new case in tlb_next_batch() that previously only ever
      happened when running out of memory.
      
      The real bug is that the TLB gather virtual memory range setup is subtly
      buggered.  It was introduced in commit 597e1c35 ("mm/mmu_gather:
      enable tlb flush range in generic mmu_gather"), and the range handling
      was already fixed at least once in commit e6c495a9 ("mm: fix the TLB
      range flushed when __tlb_remove_page() runs out of slots"), but that fix
      was not complete.
      
      The problem with the TLB gather virtual address range is that it isn't
      set up by the initial tlb_gather_mmu() initialization (which didn't get
      the TLB range information), but it is set up ad-hoc later by the
      functions that actually flush the TLB.  And so any such case that forgot
      to update the TLB range entries would potentially miss TLB invalidates.
      
      Rather than try to figure out exactly which particular ad-hoc range
      setup was missing (I personally suspect it's the hugetlb case in
      zap_huge_pmd(), which didn't have the same logic as zap_pte_range()
      did), this patch just gets rid of the problem at the source: make the
      TLB range information available to tlb_gather_mmu(), and initialize it
      when initializing all the other tlb gather fields.
      
      This makes the patch larger, but conceptually much simpler.  And the end
      result is much more understandable; even if you want to play games with
      partial ranges when invalidating the TLB contents in chunks, now the
      range information is always there, and anybody who doesn't want to
      bother with it won't introduce subtle bugs.
      
      Ben verified that this fixes his problem.
      Reported-bisected-and-tested-by: NBen Tebulin <tebulin@googlemail.com>
      Build-testing-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Build-testing-by: NRichard Weinberger <richard.weinberger@gmail.com>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2b047252
  4. 03 10月, 2012 1 次提交
  5. 31 5月, 2011 1 次提交
  6. 25 5月, 2011 1 次提交
  7. 19 1月, 2010 1 次提交
  8. 16 1月, 2010 2 次提交
  9. 28 7月, 2009 1 次提交
    • B
      mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() · 9e1b32ca
      Benjamin Herrenschmidt 提交于
      mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
      
      Upcoming paches to support the new 64-bit "BookE" powerpc architecture
      will need to have the virtual address corresponding to PTE page when
      freeing it, due to the way the HW table walker works.
      
      Basically, the TLB can be loaded with "large" pages that cover the whole
      virtual space (well, sort-of, half of it actually) represented by a PTE
      page, and which contain an "indirect" bit indicating that this TLB entry
      RPN points to an array of PTEs from which the TLB can then create direct
      entries. Thus, in order to invalidate those when PTE pages are deleted,
      we need the virtual address to pass to tlbilx or tlbivax instructions.
      
      The old trick of sticking it somewhere in the PTE page struct page sucks
      too much, the address is almost readily available in all call sites and
      almost everybody implemets these as macros, so we may as well add the
      argument everywhere. I added it to the pmd and pud variants for consistency.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: David Howells <dhowells@redhat.com> [MN10300 & FRV]
      Acked-by: NNick Piggin <npiggin@suse.de>
      Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [s390]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9e1b32ca
  10. 17 3月, 2009 1 次提交
    • P
      sh: Flush only the needed range when unmapping a VMA. · c2035184
      Paul Mundt 提交于
      This follows the ARM change from Aaro Koskinen:
      
      	When unmapping N pages (e.g. shared memory) the amount of TLB
      	flushes done can be (N*PAGE_SIZE/ZAP_BLOCK_SIZE)*N although it
      	should be N at maximum. With PREEMPT kernel ZAP_BLOCK_SIZE is 8
      	pages, so there is a noticeable performance penalty when
      	unmapping a large VMA and the system is spending its time in
      	flush_tlb_range().
      
      	The problem is that tlb_end_vma() is always flushing the full VMA
      	range. The subrange that needs to be flushed can be calculated by
      	tlb_remove_tlb_entry(). This approach was suggested by Hugh
      	Dickins, and is also used by other arches.
      
      	The speed increase is roughly 3x for 8M mappings and for larger
      	mappings even more.
      
      Bits and peices are taken from the ARM patch as well as the existing
      arch/um implementation that is quite similar.
      
      The end result is a significant reduction in both partial and full TLB
      flushes initiated through flush_tlb_range().
      
      At the same time, the nommu implementation was broken, had a superfluous
      cache flush, and subsequently would have triggered a BUG_ON() if a
      code-path had triggered it. Tidy this up for correctness and provide a
      nopped-out implementation there.
      
      More background on the initial discussion can be found at:
      
      	http://marc.info/?t=123609820900002&r=1&w=2
      	http://marc.info/?t=123660375800003&r=1&w=2Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      c2035184
  11. 29 7月, 2008 1 次提交
  12. 14 2月, 2008 1 次提交
    • P
      sh: asm/tlb.h needs linux/pagemap.h for CONFIG_SWAP=n. · bb7de070
      Paul Mundt 提交于
      linux/swap.h really wants to include linux/pagemap.h in order to satisfy
      the page_cache_release()/release_pages() definition requirements when
      CONFIG_SWAP=n. Unfortunately the code in question contains:
      
      	/* only sparc can not include linux/pagemap.h in this file
      	 * so leave page_cache_release and release_pages undeclared... */
      	#define free_page_and_swap_cache(page) \
      		page_cache_release(page)
      	#define free_pages_and_swap_cache(pages, nr) \
      		release_pages((pages), (nr), 0);
      
      so it looks like we're stuck with doing it in asm/tlb.h instead, as
      others already do (ARM, CRIS, etc.). Grumble.
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      bb7de070
  13. 28 1月, 2008 1 次提交
  14. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4