nvmap: page pool: fix background thread
authorColin Cross <ccross@android.com>
Mon, 11 Aug 2014 23:09:51 +0000 (16:09 -0700)
committerWinnie Hsu <whsu@nvidia.com>
Tue, 12 May 2015 20:28:18 +0000 (13:28 -0700)
commitc81dc1143c8c6d642adfd527ba43d16355ffd373
tree1eae786401b2b0c5f13bf8686f55389aac6c4716
parent4a3a5bb3cb51bcd55d0695fcb4d6d28b4b2f2461
nvmap: page pool: fix background thread

Fix a race condition in the background allocator where
wake_up_process could be called just before set_current_state
changed the state to TASK_INTERRUPTIBLE, causing the thread
not to wake.  Use a waitqueue instead.

Also make the background allocator nicer by marking it freezable
so it doesn't compete with suspend, and setting it SCHED_IDLE so
it only runs when no other threads want to run.

Change-Id: If95da005bb1fc4c9b5e802d40730803a57057fe1
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/664673
GVS: Gerrit_Virtual_Submit
Reviewed-on: http://git-master/r/736427
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Alex Waterman <alexw@nvidia.com>
drivers/video/tegra/nvmap/nvmap_pp.c
drivers/video/tegra/nvmap/nvmap_priv.h