1. 13 9月, 2013 2 次提交
    • J
      arch: mm: pass userspace fault flag to generic fault handler · 759496ba
      Johannes Weiner 提交于
      Unlike global OOM handling, memory cgroup code will invoke the OOM killer
      in any OOM situation because it has no way of telling faults occuring in
      kernel context - which could be handled more gracefully - from
      user-triggered faults.
      
      Pass a flag that identifies faults originating in user space from the
      architecture-specific fault handlers to generic code so that memcg OOM
      handling can be improved.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Cc: David Rientjes <rientjes@google.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: azurIt <azurit@pobox.sk>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      759496ba
    • J
      arch: mm: remove obsolete init OOM protection · 94bce453
      Johannes Weiner 提交于
      The memcg code can trap tasks in the context of the failing allocation
      until an OOM situation is resolved.  They can hold all kinds of locks
      (fs, mm) at this point, which makes it prone to deadlocking.
      
      This series converts memcg OOM handling into a two step process that is
      started in the charge context, but any waiting is done after the fault
      stack is fully unwound.
      
      Patches 1-4 prepare architecture handlers to support the new memcg
      requirements, but in doing so they also remove old cruft and unify
      out-of-memory behavior across architectures.
      
      Patch 5 disables the memcg OOM handling for syscalls, readahead, kernel
      faults, because they can gracefully unwind the stack with -ENOMEM.  OOM
      handling is restricted to user triggered faults that have no other
      option.
      
      Patch 6 reworks memcg's hierarchical OOM locking to make it a little
      more obvious wth is going on in there: reduce locked regions, rename
      locking functions, reorder and document.
      
      Patch 7 implements the two-part OOM handling such that tasks are never
      trapped with the full charge stack in an OOM situation.
      
      This patch:
      
      Back before smart OOM killing, when faulting tasks were killed directly on
      allocation failures, the arch-specific fault handlers needed special
      protection for the init process.
      
      Now that all fault handlers call into the generic OOM killer (see commit
      609838cf: "mm: invoke oom-killer from remaining unconverted page
      fault handlers"), which already provides init protection, the
      arch-specific leftovers can be removed.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: azurIt <azurit@pobox.sk>
      Acked-by: Vineet Gupta <vgupta@synopsys.com>	[arch/arc bits]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      94bce453
  2. 04 9月, 2013 2 次提交
    • C
      tile: remove support for TILE64 · d7c96611
      Chris Metcalf 提交于
      This chip is no longer being actively developed for (it was superceded
      by the TILEPro64 in 2008), and in any case the existing compiler and
      toolchain in the community do not support it.  It's unlikely that the
      kernel works with TILE64 at this point as the configuration has not been
      tested in years.  The support is also awkward as it requires maintaining
      a significant number of ifdefs.  So, just remove it altogether.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      d7c96611
    • C
      tile: don't assume user privilege is zero · 051168df
      Chris Metcalf 提交于
      Technically, user privilege is anything less than kernel
      privilege.  We modify the existing user_mode() macro to have
      this semantic (and use it in a couple of places it wasn't being
      used before), and add an IS_KERNEL_EX1() macro to the assembly
      code as well.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      051168df
  3. 30 8月, 2013 1 次提交
  4. 14 8月, 2013 2 次提交
    • C
      tile: remove calls to arch_flush_lazy_mmu_mode() · 1182b69c
      Chris Metcalf 提交于
      Since it's a no-op on tile anyway, there's no reason to be calling
      it in tile-specific code.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      1182b69c
    • C
      tile: fast-path unaligned memory access for tilegx · 2f9ac29e
      Chris Metcalf 提交于
      This change enables unaligned userspace memory access via a kernel
      fast path on tilegx.  The kernel tracks user PC/instruction pairs
      per-thread using a direct-mapped cache in userspace.  The cache
      maps those PC/instruction pairs to JIT'ed instruction sequences that
      load or store using byte-wide load store intructions and then
      synthesize 2-, 4- or 8-byte load or store results.  Once an
      instruction has been seen to generate an unaligned access once,
      subsequent hits on that instruction typically require overhead
      of only around 50 cycles if cache and TLB is hot.
      
      We support the prctl() PR_GET_UNALIGN / PR_SET_UNALIGN sys call to
      enable or disable unaligned fixups on a per-process basis.
      
      To do this we pull some of the tilepro unaligned support out of the
      single_step.c file; tilepro uses instruction disassembly for both
      single-step and unaligned access support.  Since tilegx actually has
      hardware singlestep support, though, it's cleaner to keep the tilegx
      unaligned access code in a separate file.  While we're at it,
      properly rename the tilepro-specific types, etc., to have tilepro
      suffixes instead of generic tile suffixes.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      2f9ac29e
  5. 13 8月, 2013 1 次提交
  6. 10 7月, 2013 1 次提交
    • J
      mm: invoke oom-killer from remaining unconverted page fault handlers · 609838cf
      Johannes Weiner 提交于
      A few remaining architectures directly kill the page faulting task in an
      out of memory situation.  This is usually not a good idea since that
      task might not even use a significant amount of memory and so may not be
      the optimal victim to resolve the situation.
      
      Since 2.6.29's 1c0fe6e3 ("mm: invoke oom-killer from page fault") there
      is a hook that architecture page fault handlers are supposed to call to
      invoke the OOM killer and let it pick the right task to kill.  Convert
      the remaining architectures over to this hook.
      
      To have the previous behavior of simply taking out the faulting task the
      vm.oom_kill_allocating_task sysctl can be set to 1.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Reviewed-by: NMichal Hocko <mhocko@suse.cz>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Acked-by: Vineet Gupta <vgupta@synopsys.com>   [arch/arc bits]
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Chen Liqin <liqin.chen@sunplusct.com>
      Cc: Lennox Wu <lennox.wu@gmail.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      609838cf
  7. 24 10月, 2012 1 次提交
    • C
      arch/tile: eliminate pt_regs trampolines for syscalls · 6b14e419
      Chris Metcalf 提交于
      Using the new current_pt_regs() model, we can remove some trampolines
      from assembly code and call directly to the C syscall implementations.
      rt_sigreturn() and clone() still need some assembly wrapping, but no
      longer are passed a pt_regs pointer.  sigaltstack() and the
      tilepro-specific cmpxchg_badaddr() syscalls are now just straight C.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      6b14e419
  8. 09 10月, 2012 1 次提交
  9. 26 5月, 2012 2 次提交
    • K
      tile/mm/fault.c: Port OOM changes to handle_page_fault · 4ce6bea2
      Kautuk Consul 提交于
      Commit d065bd81
      (mm: retry page fault when blocking on disk transfer) and
      commit 37b23e05
      (x86,mm: make pagefault killable)
      
      The above commits introduced changes into the x86 pagefault handler
      for making the page fault handler retryable as well as killable.
      
      These changes reduce the mmap_sem hold time, which is crucial
      during OOM killer invocation.
      
      Port these changes to tile.
      Signed-off-by: NKautuk Consul <consul.kautuk@gmail.com>
      [cmetcalf@tilera.com: initialize "flags" after "write" updated.]
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      4ce6bea2
    • C
      arch/tile: support multiple huge page sizes dynamically · 621b1955
      Chris Metcalf 提交于
      This change adds support for a new "super" bit in the PTE, using the new
      arch_make_huge_pte() method.  The Tilera hypervisor sees the bit set at a
      given level of the page table and gangs together 4, 16, or 64 consecutive
      pages from that level of the hierarchy to create a larger TLB entry.
      
      One extra "super" page size can be specified at each of the three levels
      of the page table hierarchy on tilegx, using the "hugepagesz" argument
      on the boot command line.  A new hypervisor API is added to allow Linux
      to tell the hypervisor how many PTEs to gang together at each level of
      the page table.
      
      To allow pre-allocating huge pages larger than the buddy allocator can
      handle, this change modifies the Tilera bootmem support to put all of
      memory on tilegx platforms into bootmem.
      
      As part of this change I eliminate the vestigial CONFIG_HIGHPTE support,
      which never worked anyway, and eliminate the hv_page_size() API in favor
      of the standard vma_kernel_pagesize() API.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      621b1955
  10. 03 4月, 2012 3 次提交
  11. 29 3月, 2012 1 次提交
  12. 12 12月, 2011 1 次提交
  13. 20 5月, 2011 1 次提交
    • C
      arch/tile: support signal "exception-trace" hook · 571d76ac
      Chris Metcalf 提交于
      This change adds support for /proc/sys/debug/exception-trace to tile.
      Like x86 and sparc, by default it is set to "1", generating a one-line
      printk whenever a user process crashes.  By setting it to "2", we get
      a much more complete userspace diagnostic at crash time, including
      a user-space backtrace, register dump, and memory dump around the
      address of the crash.
      
      Some vestiges of the Tilera-internal version of this support are
      removed with this patch (the show_crashinfo variable and the
      arch_coredump_signal function).  We retain a "crashinfo" boot parameter
      which allows you to set the boot-time value of exception-trace.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      571d76ac
  14. 03 5月, 2011 1 次提交
    • C
      arch/tile: support TIF_NOTIFY_RESUME · 313ce674
      Chris Metcalf 提交于
      This support is required for CONFIG_KEYS, NFSv4 kernel DNS, etc.
      The change is slightly more complex than the minimal thing, since
      I took advantage of having to go into the assembly code to just
      move a bunch of stuff into C code: specifically, the schedule(),
      do_async_page_fault(), do_signal(), and single_step_once() support,
      in addition to the TIF_NOTIFY_RESUME support.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      313ce674
  15. 31 3月, 2011 1 次提交
  16. 11 3月, 2011 1 次提交
  17. 18 11月, 2010 1 次提交
  18. 16 10月, 2010 1 次提交
  19. 15 10月, 2010 1 次提交
    • C
      arch/tile: Use <asm-generic/syscalls.h> · d929b6ae
      Chris Metcalf 提交于
      With this change we now include <asm-generic/syscalls.h> into the "tile"
      version of the header.  To take full advantage of the prototypes there,
      we also change our naming convention for "struct pt_regs *" syscalls so
      that, e.g., _sys_execve() is the "true" syscall entry, which sets the
      appropriate register to point to the pt_regs before calling sys_execve().
      
      While doing this I realized I no longer needed the fork and vfork
      entry point stubs, since those functions aren't in the generic
      syscall ABI, so I removed them as well.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      d929b6ae
  20. 13 8月, 2010 1 次提交
    • C
      arch/tile: Various cleanups. · c745a8a1
      Chris Metcalf 提交于
      This change rolls up random cleanups not representing any actual bugs.
      
      - Remove a stale CONFIG_ value from the default tile_defconfig
      - Remove unused tns_atomic_xxx() family of methods from <asm/atomic.h>
      - Optimize get_order() using Tile's "clz" instruction
      - Fix a bad hypervisor upcall name (not currently used in Linux anyway)
      - Use __copy_in_user_inatomic() name for consistency, and export it
      - Export some additional hypervisor driver I/O upcalls and some homecache calls
      - Remove the obfuscating MEMCPY_TEST_WH64 support code
      - Other stray comment cleanups, #if 0 removal, etc.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      c745a8a1
  21. 07 7月, 2010 1 次提交
    • C
      arch/tile: Miscellaneous cleanup changes. · 0707ad30
      Chris Metcalf 提交于
      This commit is primarily changes caused by reviewing "sparse"
      and "checkpatch" output on our sources, so is somewhat noisy, since
      things like "printk() -> pr_err()" (or whatever) throughout the
      codebase tend to get tedious to read.  Rather than trying to tease
      apart precisely which things changed due to which type of code
      review, this commit includes various cleanups in the code:
      
      - sparse: Add declarations in headers for globals.
      - sparse: Fix __user annotations.
      - sparse: Using gfp_t consistently instead of int.
      - sparse: removing functions not actually used.
      - checkpatch: Clean up printk() warnings by using pr_info(), etc.;
        also avoid partial-line printks except in bootup code.
        - checkpatch: Use exposed structs rather than typedefs.
        - checkpatch: Change some C99 comments to C89 comments.
      
      In addition, a couple of minor other changes are rolled in
      to this commit:
      
      - Add support for a "raise" instruction to cause SIGFPE, etc., to be raised.
      - Remove some compat code that is unnecessary when we fully eliminate
        some of the deprecated syscalls from the generic syscall ABI.
      - Update the tile_defconfig to reflect current config contents.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      0707ad30
  22. 05 6月, 2010 1 次提交