io_uring: rename ctx->account_mem field
Rename account_mem to limit_name to clarify its purpose. Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a087e2b519
commit
aad5d8da1b
|
@ -226,7 +226,7 @@ struct io_ring_ctx {
|
||||||
struct {
|
struct {
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned int compat: 1;
|
unsigned int compat: 1;
|
||||||
unsigned int account_mem: 1;
|
unsigned int limit_mem: 1;
|
||||||
unsigned int cq_overflow_flushed: 1;
|
unsigned int cq_overflow_flushed: 1;
|
||||||
unsigned int drain_next: 1;
|
unsigned int drain_next: 1;
|
||||||
unsigned int eventfd_async: 1;
|
unsigned int eventfd_async: 1;
|
||||||
|
@ -6995,13 +6995,13 @@ static inline int __io_account_mem(struct user_struct *user,
|
||||||
|
|
||||||
static void io_unaccount_mem(struct io_ring_ctx *ctx, unsigned long nr_pages)
|
static void io_unaccount_mem(struct io_ring_ctx *ctx, unsigned long nr_pages)
|
||||||
{
|
{
|
||||||
if (ctx->account_mem)
|
if (ctx->limit_mem)
|
||||||
__io_unaccount_mem(ctx->user, nr_pages);
|
__io_unaccount_mem(ctx->user, nr_pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int io_account_mem(struct io_ring_ctx *ctx, unsigned long nr_pages)
|
static int io_account_mem(struct io_ring_ctx *ctx, unsigned long nr_pages)
|
||||||
{
|
{
|
||||||
if (ctx->account_mem)
|
if (ctx->limit_mem)
|
||||||
return __io_account_mem(ctx->user, nr_pages);
|
return __io_account_mem(ctx->user, nr_pages);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -7853,7 +7853,7 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
|
||||||
{
|
{
|
||||||
struct user_struct *user = NULL;
|
struct user_struct *user = NULL;
|
||||||
struct io_ring_ctx *ctx;
|
struct io_ring_ctx *ctx;
|
||||||
bool account_mem;
|
bool limit_mem;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!entries)
|
if (!entries)
|
||||||
|
@ -7892,9 +7892,9 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
|
||||||
}
|
}
|
||||||
|
|
||||||
user = get_uid(current_user());
|
user = get_uid(current_user());
|
||||||
account_mem = !capable(CAP_IPC_LOCK);
|
limit_mem = !capable(CAP_IPC_LOCK);
|
||||||
|
|
||||||
if (account_mem) {
|
if (limit_mem) {
|
||||||
ret = __io_account_mem(user,
|
ret = __io_account_mem(user,
|
||||||
ring_pages(p->sq_entries, p->cq_entries));
|
ring_pages(p->sq_entries, p->cq_entries));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -7905,14 +7905,14 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p,
|
||||||
|
|
||||||
ctx = io_ring_ctx_alloc(p);
|
ctx = io_ring_ctx_alloc(p);
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
if (account_mem)
|
if (limit_mem)
|
||||||
__io_unaccount_mem(user, ring_pages(p->sq_entries,
|
__io_unaccount_mem(user, ring_pages(p->sq_entries,
|
||||||
p->cq_entries));
|
p->cq_entries));
|
||||||
free_uid(user);
|
free_uid(user);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
ctx->compat = in_compat_syscall();
|
ctx->compat = in_compat_syscall();
|
||||||
ctx->account_mem = account_mem;
|
ctx->limit_mem = limit_mem;
|
||||||
ctx->user = user;
|
ctx->user = user;
|
||||||
ctx->creds = get_current_cred();
|
ctx->creds = get_current_cred();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue