dect
/
linux-2.6
Archived
13
0
Fork 0

drm/i915: Assert that the exec object lookup table is a power-of-two

As we make the simplification of using a power-of-two size for the
execbuffer handle-to-object TLB, we should validate that this is actually
true and so clarify that premise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Chris Wilson 2012-09-18 10:04:02 +01:00 committed by Daniel Vetter
parent 3cce574f01
commit 41783eea1a
1 changed files with 1 additions and 0 deletions

View File

@ -44,6 +44,7 @@ eb_create(int size)
{
struct eb_objects *eb;
int count = PAGE_SIZE / sizeof(struct hlist_head) / 2;
BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head)));
while (count > size)
count >>= 1;
eb = kzalloc(count*sizeof(struct hlist_head) +