Re: [PATCH] xfrm: dst_entries_init() per-net dst_ops
From: Dan Streetman
Date: Wed Oct 28 2015 - 11:09:54 EST
On Wed, Oct 28, 2015 at 9:42 AM, Hannes Frederic Sowa
> On Wed, Oct 28, 2015, at 14:32, Dan Streetman wrote:
>> On Tue, Oct 27, 2015 at 12:15 PM, <dan.streetman@xxxxxxxxxxxxx> wrote:
>> > From: Dan Streetman <dan.streetman@xxxxxxxxxxxxx>
>> > The ipv4 and ipv6 xfrms each create a template dst_ops object, and
>> > perform dst_entries_init() on the template objects. Then each net
>> > namespace has its net.xfrm.xfrm_dst_ops field set to the template
>> > values. The problem with that is the dst_ops.pcpuc_entries field is
>> > a percpu counter and cannot be used correctly by simply copying it to
>> > another object.
> How hard would it be to split of the counters from the dst_ops struct?
> We could make dst_ops instances const and have normal pointers to them
> and keep the dst_entries as a small array in net namespace?
Well, the dst_ops->pcpuc_entries counter is used in dst.c which just
gets a struct dst_ops *, so it doesn't have access to the owning net
namespace. And, not all dst_ops users have a per-net-namespace
dst_ops; ipv4/route.c for example uses a global "ipv4_dst_ops" object.
So it probably does need to stay owned by dst_ops.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/