diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/core/flow.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/core/flow.c b/net/core/flow.c index 344a184011fd..102f8ea2eb6e 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
| @@ -45,6 +45,8 @@ struct flow_flush_info { | |||
| 45 | struct completion completion; | 45 | struct completion completion; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | static struct kmem_cache *flow_cachep __read_mostly; | ||
| 49 | |||
| 48 | #define flow_cache_hash_size(cache) (1 << (cache)->hash_shift) | 50 | #define flow_cache_hash_size(cache) (1 << (cache)->hash_shift) |
| 49 | #define FLOW_HASH_RND_PERIOD (10 * 60 * HZ) | 51 | #define FLOW_HASH_RND_PERIOD (10 * 60 * HZ) |
| 50 | 52 | ||
| @@ -75,7 +77,7 @@ static void flow_entry_kill(struct flow_cache_entry *fle, | |||
| 75 | { | 77 | { |
| 76 | if (fle->object) | 78 | if (fle->object) |
| 77 | fle->object->ops->delete(fle->object); | 79 | fle->object->ops->delete(fle->object); |
| 78 | kmem_cache_free(xfrm->flow_cachep, fle); | 80 | kmem_cache_free(flow_cachep, fle); |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | static void flow_cache_gc_task(struct work_struct *work) | 83 | static void flow_cache_gc_task(struct work_struct *work) |
| @@ -230,7 +232,7 @@ flow_cache_lookup(struct net *net, const struct flowi *key, u16 family, u8 dir, | |||
| 230 | if (fcp->hash_count > fc->high_watermark) | 232 | if (fcp->hash_count > fc->high_watermark) |
| 231 | flow_cache_shrink(fc, fcp); | 233 | flow_cache_shrink(fc, fcp); |
| 232 | 234 | ||
| 233 | fle = kmem_cache_alloc(net->xfrm.flow_cachep, GFP_ATOMIC); | 235 | fle = kmem_cache_alloc(flow_cachep, GFP_ATOMIC); |
| 234 | if (fle) { | 236 | if (fle) { |
| 235 | fle->net = net; | 237 | fle->net = net; |
| 236 | fle->family = family; | 238 | fle->family = family; |
| @@ -435,10 +437,10 @@ int flow_cache_init(struct net *net) | |||
| 435 | int i; | 437 | int i; |
| 436 | struct flow_cache *fc = &net->xfrm.flow_cache_global; | 438 | struct flow_cache *fc = &net->xfrm.flow_cache_global; |
| 437 | 439 | ||
| 438 | /* Initialize per-net flow cache global variables here */ | 440 | if (!flow_cachep) |
| 439 | net->xfrm.flow_cachep = kmem_cache_create("flow_cache", | 441 | flow_cachep = kmem_cache_create("flow_cache", |
| 440 | sizeof(struct flow_cache_entry), | 442 | sizeof(struct flow_cache_entry), |
| 441 | 0, SLAB_PANIC, NULL); | 443 | 0, SLAB_PANIC, NULL); |
| 442 | spin_lock_init(&net->xfrm.flow_cache_gc_lock); | 444 | spin_lock_init(&net->xfrm.flow_cache_gc_lock); |
| 443 | INIT_LIST_HEAD(&net->xfrm.flow_cache_gc_list); | 445 | INIT_LIST_HEAD(&net->xfrm.flow_cache_gc_list); |
| 444 | INIT_WORK(&net->xfrm.flow_cache_gc_work, flow_cache_gc_task); | 446 | INIT_WORK(&net->xfrm.flow_cache_gc_work, flow_cache_gc_task); |
