Commit 7317ac87 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt

powerpc: Convert mmu context allocator from idr to ida

We can use the much more lightweight ida allocator since we don't
need the pointer storage idr provides.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 66fcb105
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
static DEFINE_SPINLOCK(mmu_context_lock); static DEFINE_SPINLOCK(mmu_context_lock);
static DEFINE_IDR(mmu_context_idr); static DEFINE_IDA(mmu_context_ida);
/* /*
* The proto-VSID space has 2^35 - 1 segments available for user mappings. * The proto-VSID space has 2^35 - 1 segments available for user mappings.
...@@ -39,11 +39,11 @@ int __init_new_context(void) ...@@ -39,11 +39,11 @@ int __init_new_context(void)
int err; int err;
again: again:
if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL)) if (!ida_pre_get(&mmu_context_ida, GFP_KERNEL))
return -ENOMEM; return -ENOMEM;
spin_lock(&mmu_context_lock); spin_lock(&mmu_context_lock);
err = idr_get_new_above(&mmu_context_idr, NULL, 1, &index); err = ida_get_new_above(&mmu_context_ida, 1, &index);
spin_unlock(&mmu_context_lock); spin_unlock(&mmu_context_lock);
if (err == -EAGAIN) if (err == -EAGAIN)
...@@ -53,7 +53,7 @@ int __init_new_context(void) ...@@ -53,7 +53,7 @@ int __init_new_context(void)
if (index > MAX_CONTEXT) { if (index > MAX_CONTEXT) {
spin_lock(&mmu_context_lock); spin_lock(&mmu_context_lock);
idr_remove(&mmu_context_idr, index); ida_remove(&mmu_context_ida, index);
spin_unlock(&mmu_context_lock); spin_unlock(&mmu_context_lock);
return -ENOMEM; return -ENOMEM;
} }
...@@ -85,7 +85,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -85,7 +85,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
void __destroy_context(int context_id) void __destroy_context(int context_id)
{ {
spin_lock(&mmu_context_lock); spin_lock(&mmu_context_lock);
idr_remove(&mmu_context_idr, context_id); ida_remove(&mmu_context_ida, context_id);
spin_unlock(&mmu_context_lock); spin_unlock(&mmu_context_lock);
} }
EXPORT_SYMBOL_GPL(__destroy_context); EXPORT_SYMBOL_GPL(__destroy_context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment