]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/gtt: Free unused lower-level page tables
authorMichał Winiarski <michal.winiarski@intel.com>
Thu, 13 Oct 2016 12:02:42 +0000 (14:02 +0200)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 14 Oct 2016 11:42:23 +0000 (12:42 +0100)
commit37989d8e483705bc42272a9793f7333ca5ee1fb7
tree92553b9c0340289e603ac3072f1487aa5c2505b7
parentdcd88e8ac4cbabbc3ee9028ab3457c34ccef6621
drm/i915/gtt: Free unused lower-level page tables

Since "Dynamic page table allocations" were introduced, our page tables
can grow (being dynamically allocated) with address space range usage.
Unfortunately, their lifetime is bound to vm. This is not a huge problem
when we're not using softpin - drm_mm is creating an upper bound on used
range by causing addresses for our VMAs to eventually be reused.

With softpin, long lived contexts can drain the system out of memory
even with a single "small" object. For example:

bo = bo_alloc(size);
while(true)
    offset += size;
    exec(bo, offset);

Will cause us to create new allocations until all memory in the system
is used for tracking GPU pages (even though almost all PTEs in this vm
are pointing to scratch).

Let's free unused page tables in clear_range to prevent this - if no
entries are used, we can safely free it and return this information to
the caller (so that higher-level entry is pointing to scratch).

v2: Document return value and free semantics (Joonas)
v3: No newlines in vars block (Joonas)
v4: Drop redundant local 'reduce' variable
v5: Handle CI fail with enable_ppgtt=2

Cc: Michel Thierry <michel.thierry@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1476360162-24062-3-git-send-email-michal.winiarski@intel.com
drivers/gpu/drm/i915/i915_gem_gtt.c