[PATCH 0/5] prevent OOM triggered by TTM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



currently ttm code has no any allocation limit. So it allows pages 
allocatation unlimited until OOM. Because if swap space is full
of swapped pages and then system memory will be filled up with ttm
pages. and then any memory allocation request will trigger OOM.


the following patches is for prevent OOM triggered by TTM.
the basic idea is when allocating TTM pages, check the free swap space
firt. if it is less than the fixe limit, reject the allocation request.
but there are two exceptions which should allow it regardless of zone 
memory account limit.
a. page fault
   for ttm_mem_global_reserve if serving for page fault routine,
   because page fault routing already grabbed system memory so the 
   allowance of this exception is harmless. Otherwise, it will trigger
    OOM killer.
b. suspend
   anyway, we should allow suspend success always.


at last, if bdev.no_retry is false (by defaut), keep the original behavior
no any change.

Roger He (5):
  drm/ttm: check if the free swap space is under limit 256MB
  drm/ttm: keep original behavior except with flag no_retry
  drm/ttm: use bit flag to replace allow_reserved_eviction in
    ttm_operation_ctx
  drm/ttm: add bit flag TTM_OPT_FLAG_ALLOW_ALLOC_ANYWAY
  drm/ttm: add input parameter allow_allo_anyway for ttm_bo_evict_mm

 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 10 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h  |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     |  8 +++--
 drivers/gpu/drm/nouveau/nouveau_drm.c       |  2 +-
 drivers/gpu/drm/qxl/qxl_object.c            |  4 +--
 drivers/gpu/drm/radeon/radeon_device.c      |  6 ++--
 drivers/gpu/drm/radeon/radeon_object.c      |  6 ++--
 drivers/gpu/drm/radeon/radeon_object.h      |  3 +-
 drivers/gpu/drm/ttm/ttm_bo.c                | 19 +++++++----
 drivers/gpu/drm/ttm/ttm_bo_vm.c             |  6 ++--
 drivers/gpu/drm/ttm/ttm_memory.c            | 51 ++++++++++++++++++++++++++---
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c    |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  6 ++--
 include/drm/ttm/ttm_bo_api.h                | 14 ++++++--
 include/drm/ttm/ttm_memory.h                |  6 ++++
 18 files changed, 111 insertions(+), 43 deletions(-)

-- 
2.7.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux