X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-tp-mempool.c;h=7e1b51d3cf7ff2ac9f5b0e996444e09ab2cb9c2b;hb=b7cdc18250880cc44edeef4a4b42c8ac7a135a6d;hp=d984bd4511b209fbb528c8b19102b4538a1df4b8;hpb=f771eda68a28a432a87a7a71b23aab9692828700;p=lttng-modules.git diff --git a/lttng-tp-mempool.c b/lttng-tp-mempool.c index d984bd45..7e1b51d3 100644 --- a/lttng-tp-mempool.c +++ b/lttng-tp-mempool.c @@ -1,21 +1,8 @@ -/* +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * * lttng-tp-mempool.c * * Copyright (C) 2018 Julien Desfossez - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -70,8 +57,8 @@ int lttng_tp_mempool_init(void) for (i = 0; i < LTTNG_TP_MEMPOOL_NR_BUF_PER_CPU; i++) { struct lttng_tp_buf_entry *entry; - entry = kzalloc(sizeof(struct lttng_tp_buf_entry), - GFP_KERNEL); + entry = kzalloc_node(sizeof(struct lttng_tp_buf_entry), + GFP_KERNEL, cpu_to_node(cpu)); if (!entry) { ret = -ENOMEM; goto error_free_pool; @@ -151,19 +138,12 @@ void lttng_tp_mempool_free(void *ptr) struct lttng_tp_buf_entry *entry; struct per_cpu_buf *cpu_buf; - if (!ptr) { + if (!ptr) goto end; - } - entry = container_of(ptr, struct lttng_tp_buf_entry, buf); - if (!entry) { - goto end; - } - cpu_buf = per_cpu_ptr(pool, entry->cpu); - if (!cpu_buf) { + if (!cpu_buf) goto end; - } /* Add it to the free list. */ list_add_tail(&entry->list, &cpu_buf->free_list);