[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dfadfd49-a7ce-4327-94bd-a1a24cbdd5a3@lunn.ch>
Date: Wed, 30 Oct 2024 01:09:50 +0100
From: Andrew Lunn <andrew@...n.ch>
To: John Ousterhout <ouster@...stanford.edu>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next 04/12] net: homa: create homa_pool.h and
homa_pool.c
On Mon, Oct 28, 2024 at 02:35:31PM -0700, John Ousterhout wrote:
> These files implement Homa's mechanism for managing application-level
> buffer space for incoming messages This mechanism is needed to allow
> Homa to copy data out to user space in parallel with receiving packets;
> it was discussed in a talk at NetDev 0x17.
>
> Signed-off-by: John Ousterhout <ouster@...stanford.edu>
> ---
> net/homa/homa_pool.c | 434 +++++++++++++++++++++++++++++++++++++++++++
> net/homa/homa_pool.h | 152 +++++++++++++++
> 2 files changed, 586 insertions(+)
> create mode 100644 net/homa/homa_pool.c
> create mode 100644 net/homa/homa_pool.h
>
> diff --git a/net/homa/homa_pool.c b/net/homa/homa_pool.c
> new file mode 100644
> index 000000000000..6c59f659fba1
> --- /dev/null
> +++ b/net/homa/homa_pool.c
> @@ -0,0 +1,434 @@
> +// SPDX-License-Identifier: BSD-2-Clause
> +
> +#include "homa_impl.h"
> +#include "homa_pool.h"
> +
> +/* This file contains functions that manage user-space buffer pools. */
> +
> +/* Pools must always have at least this many bpages (no particular
> + * reasoning behind this value).
> + */
> +#define MIN_POOL_SIZE 2
> +
> +/* Used when determining how many bpages to consider for allocation. */
> +#define MIN_EXTRA 4
> +
> +/* When running unit tests, allow HOMA_BPAGE_SIZE and HOMA_BPAGE_SHIFT
> + * to be overridden.
> + */
> +#ifdef __UNIT_TEST__
> +#include "mock.h"
> +#undef HOMA_BPAGE_SIZE
> +#define HOMA_BPAGE_SIZE mock_bpage_size
> +#undef HOMA_BPAGE_SHIFT
> +#define HOMA_BPAGE_SHIFT mock_bpage_shift
> +#endif
> +
> +/**
> + * set_bpages_needed() - Set the bpages_needed field of @pool based
> + * on the length of the first RPC that's waiting for buffer space.
> + * The caller must own the lock for @pool->hsk.
> + * @pool: Pool to update.
> + */
> +static inline void set_bpages_needed(struct homa_pool *pool)
Generally we say no inline functions in .c files, let the compiler
decide. If you have some micro benchmark indicating the compiler is
getting it wrong, we will then consider allowing it.
It would be good if somebody who knows about the page pool took a look
at this code. Could the page pool be used as a basis?
Andrew
Powered by blists - more mailing lists