[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN3LkR+b9Onpy1XH@vergenet.net>
Date: Thu, 17 Aug 2023 09:26:09 +0200
From: Simon Horman <horms@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, hawk@...nel.org, ilias.apalodimas@...aro.org,
aleksander.lobakin@...el.com, linyunsheng@...wei.com,
almasrymina@...gle.com
Subject: Re: [RFC net-next 05/13] net: page_pool: record pools per netdev
On Wed, Aug 16, 2023 at 04:42:54PM -0700, Jakub Kicinski wrote:
> Link the page pools with netdevs. This needs to be netns compatible
> so we have two options. Either we record the pools per netns and
> have to worry about moving them as the netdev gets moved.
> Or we record them directly on the netdev so they move with the netdev
> without any extra work.
>
> Implement the latter option. Since pools may outlast netdev we need
> a place to store orphans. In time honored tradition use loopback
> for this purpose.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
...
> diff --git a/net/core/page_pool_user.c b/net/core/page_pool_user.c
...
> +static void page_pool_unreg_netdev(struct net_device *netdev)
> +{
> + struct page_pool *pool, *last;
> + struct net_device *lo;
> +
> + lo = __dev_get_by_index(dev_net(netdev), 1);
> + if (!lo) {
> + netdev_err_once(netdev,
> + "can't get lo to store orphan page pools\n");
> + page_pool_unreg_netdev_wipe(netdev);
> + return;
> + }
> +
> + mutex_lock(&page_pools_lock);
> + hlist_for_each_entry(pool, &netdev->page_pools, user.list) {
> + pool->slow.netdev = lo;
> + last = pool;
> + }
> +
> + hlist_splice_init(&netdev->page_pools, &last->user.list,
Hi Jakub.
I'm not sure if it is possible, but if the hlist loop above iterates zero
times then last will be uninitialised here.
Flagged by Smatch.
> + &lo->page_pools);
> + mutex_unlock(&page_pools_lock);
> +}
...
Powered by blists - more mailing lists