[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e99174c4-7c09-486b-b1f0-9c57b1582232@gmail.com>
Date: Wed, 30 Oct 2024 19:23:33 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: John Ousterhout <ouster@...stanford.edu>, netdev@...r.kernel.org,
edumazet@...gle.com
Subject: Re: [PATCH net-next 08/12] net: homa: create homa_incoming.c
On 10/28/24 10:35 PM, John Ousterhout wrote:
> This file contains most of the code for handling incoming packets,
> including top-level dispatching code plus specific handlers for each
> pack type. It also contains code for dispatching fully-received
> messages to waiting application threads.
>
> Signed-off-by: John Ousterhout <ouster@...stanford.edu>
> ---
> net/homa/homa_incoming.c | 1088 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 1088 insertions(+)
> create mode 100644 net/homa/homa_incoming.c
>
> diff --git a/net/homa/homa_incoming.c b/net/homa/homa_incoming.c
> new file mode 100644
> index 000000000000..c61e5e250da1
> --- /dev/null
> +++ b/net/homa/homa_incoming.c
> @@ -0,0 +1,1088 @@
> +// SPDX-License-Identifier: BSD-2-Clause
> +
> +/
> +
> +/**
> + * homa_gap_new() - Create a new gap and add it to a list.
> + * @next: Add the new gap just before this list element.
> + * @start: Offset of first byte covered by the gap.
> + * @end: Offset of byte just after the last one covered by the gap.
> + * Return: Pointer to the new gap.
> + */
> +struct homa_gap *homa_gap_new(struct list_head *next, int start, int end)
> +{
> + struct homa_gap *gap;
> +
> + gap = kmalloc(sizeof(*gap), GFP_KERNEL);
> + gap->start = start;
> + gap->end = end;
> + gap->time = get_cycles();
> + list_add_tail(&gap->links, next);
> + return gap;
> +}
1) kmalloc() can return NULL. This will crash your host.
2) get_cycles() is not generally available, and can go backward anyway.
There is a reason it is not used at all in net.
Powered by blists - more mailing lists