[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKQ1sVOuWerM7HrjR-0Yac+LtfBKb25QiQgmwMo-V_3OjAOyww@mail.gmail.com>
Date: Wed, 18 Oct 2017 12:47:40 +0200
From: Yann Ylavic <ylavic.dev@...il.com>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
jakub.kicinski@...ronome.com,
"Michael S. Tsirkin" <mst@...hat.com>, pavel.odintsov@...il.com,
Jason Wang <jasowang@...hat.com>, mchan@...adcom.com,
John Fastabend <john.fastabend@...il.com>,
peter.waskiewicz.jr@...el.com, ast@...erby.dk,
Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>,
Andy Gospodarek <andy@...yhouse.net>
Subject: Re: [net-next V8 PATCH 1/5] bpf: introduce new bpf cpu map type BPF_MAP_TYPE_CPUMAP
On Wed, Oct 18, 2017 at 10:38 AM, Jesper Dangaard Brouer
<brouer@...hat.com> wrote:
>
> On Wed, 18 Oct 2017 09:45:59 +0200 Yann Ylavic <ylavic.dev@...il.com> wrote:
>
>> On Mon, Oct 16, 2017 at 12:19 PM, Jesper Dangaard Brouer
>> <brouer@...hat.com> wrote:
>> > +
>> > + /* Notice returns -EPERM on if map size is larger than memlock limit */
>> > + ret = bpf_map_precharge_memlock(cmap->map.pages);
>> > + if (ret) {
>> > + err = ret;
>> > + goto free_cmap;
>> > + }
>> > +
>> > + /* A per cpu bitfield with a bit per possible CPU in map */
>> > + cmap->flush_needed = __alloc_percpu(cpu_map_bitmap_size(attr),
>> > + __alignof__(unsigned long));
>> > + if (!cmap->flush_needed)
>> > + goto free_cmap;
>> > +
>> > + /* Alloc array for possible remote "destination" CPUs */
>> > + cmap->cpu_map = bpf_map_area_alloc(cmap->map.max_entries *
>> > + sizeof(struct bpf_cpu_map_entry *),
>> > + cmap->map.numa_node);
>> > + if (!cmap->cpu_map)
>>
>> ret = -ENOMEM; ?
>
> Did you notice that "err" already is = -ENOMEM at this point?
My bad, I was confused by the use of "ret"...
>
>
>> > + goto free_percpu;
>> > +
>> > + return &cmap->map;
>> > +free_percpu:
>> > + free_percpu(cmap->flush_needed);
>> > +free_cmap:
>> > + kfree(cmap);
>> > + return ERR_PTR(err);
.. while actually "err" is returned.
Sorry for wasting your time.
>> > +}
>>
>>
>> Regards,
>> Yann.
Powered by blists - more mailing lists