aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-12-04 11:26:14 +0100
committerAlex Deucher <alexander.deucher@amd.com>2017-12-06 12:48:32 -0500
commitae937fe19636067ec5e20d7f1fa10c6cc6000b52 (patch)
treeedb64fd14fe0345bf11dba7bbd39b06ce935a6ae /drivers/gpu
parentdrm/amdgpu: fix amdgpu_sync_resv v2 (diff)
downloadlinux-ae937fe19636067ec5e20d7f1fa10c6cc6000b52.tar.gz
linux-ae937fe19636067ec5e20d7f1fa10c6cc6000b52.zip
drm/ttm: swap consecutive allocated pooled pages v4
When we detect consecutive allocation of pages swap them to avoid accidentally freeing them as huge page. v2: use swap v3: check if it's really the first allocated page v4: don't touch the loop variable Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Roger He <Hongbo.He@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b6f7ce286fb1..44343a2bf55c 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -958,8 +958,15 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
r = ttm_page_pool_get_pages(pool, &plist, flags, cstate,
npages - count, 0);
- list_for_each_entry(p, &plist, lru)
- pages[count++] = p;
+ first = count;
+ list_for_each_entry(p, &plist, lru) {
+ struct page *tmp = p;
+
+ /* Swap the pages if we detect consecutive order */
+ if (count > first && pages[count - 1] == tmp - 1)
+ swap(tmp, pages[count - 1]);
+ pages[count++] = tmp;
+ }
if (r) {
/* If there is any pages in the list put them back to
nstance when opening bdevMing Lei1-5/+7 2021-11-19blk-mq: don't insert FUA request with data into scheduler queueMing Lei3-8/+10 2021-11-19blk-cgroup: fix missing put device in error path from blkg_conf_pref()Yu Kuai1-4/+5 2021-11-17block: avoid to quiesce queue in elevator_init_mqMing Lei1-2/+8 2021-11-16Revert "mark pstore-blk as broken"Kees Cook1-1/+0 2021-11-15blk-mq: cancel blk-mq dispatch work in both blk_cleanup_queue and disk_release()Ming Lei5-11/+20 2021-11-15block: fix missing queue put in error pathJens Axboe1-8/+8 2021-11-15block: Check ADMIN before NICE for IOPRIO_CLASS_RTAlistair Delva1-1/+8 2021-11-14Linux 5.16-rc1v5.16-rc1Linus Torvalds1-2/+2 2021-11-14kconfig: Add support for -Wimplicit-fallthroughGustavo A. R. Silva2-5/+6 2021-11-13perf tests: Remove bash constructs from stat_all_pmu.shJames Clark1-2/+2 2021-11-13perf tests: Remove bash construct from record+zstd_comp_decomp.shJames Clark1-1/+1 2021-11-13perf test: Remove bash construct from stat_bpf_counters.sh testJames Clark1-1/+1 2021-11-13perf bench futex: Fix memory leak of perf_cpu_map__new()Sohaib Mohamed4-0/+4 2021-11-13tools arch x86: Sync the msr-index.h copy with the kernel sourcesArnaldo Carvalho de Melo1-0/+2 2021-11-13tools headers UAPI: Sync drm/i915_drm.h with the kernel sourcesArnaldo Carvalho de Melo1-1/+241 2021-11-13tools headers UAPI: Sync sound/asound.h with the kernel sourcesArnaldo Carvalho de Melo1-1/+1 2021-11-13tools headers UAPI: Sync linux/prctl.h with the kernel sourcesArnaldo Carvalho de Melo1-0/+3 2021-11-13tools headers UAPI: Sync arch prctl headers with the kernel sourcesArnaldo Carvalho de Melo1-0/+4 2021-11-13perf tools: Add more weak libbpf functionsJiri Olsa1-0/+27 2021-11-13perf bpf: Avoid memory leak from perf_env__insert_btf()Ian Rogers3-3/+10 2021-11-13perf symbols: Factor out annotation init/exitIan Rogers3-1/+22 2021-11-13perf symbols: Bit pack to save a byteIan Rogers2-3/+3 2021-11-13perf symbols: Add documentation to 'struct symbol'Ian Rogers1-3/+14 2021-11-13tools headers UAPI: Sync files changed by new futex_waitv syscallArnaldo Carvalho de Melo2-1/+5 2021-11-13perf test bpf: Use ARRAY_CHECK() instead of ad-hoc equivalent, addressing arr...Guo Zhengkui1-1/+1 2021-11-13perf arm-spe: Support hardware-based PID tracingGerman Gomez1-29/+70 2021-11-13perf arm-spe: Save context ID in recordGerman Gomez2-0/+3 2021-11-13perf arm-spe: Update --switch-events docs in 'perf record'German Gomez2-2/+4 2021-11-13perf arm-spe: Track task context switch for cpu-mode eventsNamhyung Kim2-1/+30