Skip to content

Commit

Permalink
Revert changes of sched touching from softirq context
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksey Mikhaylov <aym@tempesta-tech.com>
  • Loading branch information
ttaym committed Apr 21, 2022
1 parent e129b19 commit e7eda18
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions fw/http_sched_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,40 +403,28 @@ tfw_sched_hash_put_srv_data(struct rcu_head *rcu)
}

static int
tfw_sched_hash_srv_setup(TfwServer *srv)
tfw_sched_hash_add_srv(TfwServer *srv)
{
size_t size, seed, seed_inc = 0;
TfwHashConnList *cl = rcu_dereference_bh_check(srv->sched_data, 1);
TfwHashConnList *cl_copy;
TfwHashConnList *cl = rcu_dereference_check(srv->sched_data, 1);

if (unlikely(cl))
return -EEXIST;

seed = get_random_long();
seed_inc = get_random_int();

size = sizeof(TfwHashConnList) + srv->conn_n * sizeof(TfwHashConn);
if (!(cl_copy = kzalloc(size, in_task() ? GFP_KERNEL : GFP_ATOMIC)))
if (!(cl = kzalloc(size, GFP_KERNEL)))
return -ENOMEM;

tfw_sched_hash_add_conns(srv, cl_copy, &seed, seed_inc);

rcu_assign_pointer(srv->sched_data, cl_copy);
tfw_sched_hash_add_conns(srv, cl, &seed, seed_inc);

if (cl)
call_rcu(&cl->rcu, tfw_sched_hash_put_srv_data);
rcu_assign_pointer(srv->sched_data, cl);

return 0;
}

static int
tfw_sched_hash_add_srv(TfwServer *srv)
{
TfwHashConnList *cl = rcu_dereference_check(srv->sched_data, 1);

if (unlikely(cl))
return -EEXIST;

return tfw_sched_hash_srv_setup(srv);
}

static void
tfw_sched_hash_del_srv(TfwServer *srv)
{
Expand Down

0 comments on commit e7eda18

Please sign in to comment.