hfi1/user_exp_rcv/setup: use cache_alloc for tidlist

This commit is contained in:
Dominique Martinet
2017-09-21 16:32:59 +09:00
committed by Balazs Gerofi
parent f5ced648ef
commit 50fafa6d71

View File

@@ -73,6 +73,7 @@ struct tid_rb_node {
struct tid_group *grp; struct tid_group *grp;
}; };
struct kmalloc_cache_header tidlist_cache = { NULL };
/* /*
* RcvArray entry allocation for Expected Receives is done by the * RcvArray entry allocation for Expected Receives is done by the
@@ -98,8 +99,8 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, struct hfi1_tid_info *tinf
return -EINVAL; return -EINVAL;
} }
tidlist = kmalloc(sizeof(*tidlist)*uctxt->expected_count, tidlist = kmalloc_cache_alloc(&tidlist_cache,
IHK_MC_AP_NOWAIT); sizeof(*tidlist) * uctxt->expected_count);
if (!tidlist) if (!tidlist)
return -ENOMEM; return -ENOMEM;
@@ -198,7 +199,7 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, struct hfi1_tid_info *tinf
} }
} }
kfree(tidlist); kmalloc_cache_free(tidlist);
return ret > 0 ? 0 : ret; return ret > 0 ? 0 : ret;
} }