From patchwork Fri Jul 29 15:23:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12932532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 927E6C19F2D for ; Fri, 29 Jul 2022 15:23:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B9BE6B0073; Fri, 29 Jul 2022 11:23:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 268D68E0001; Fri, 29 Jul 2022 11:23:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 109C56B0075; Fri, 29 Jul 2022 11:23:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 031626B0073 for ; Fri, 29 Jul 2022 11:23:27 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CED401C6B56 for ; Fri, 29 Jul 2022 15:23:26 +0000 (UTC) X-FDA: 79740506412.22.91ACC22 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf11.hostedemail.com (Postfix) with ESMTP id 4AE97400D9 for ; Fri, 29 Jul 2022 15:23:26 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id x7so4888717pll.7 for ; Fri, 29 Jul 2022 08:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MuUKdiJi+CqUOLmeMIpojQqKJ/GoLF/CYoe+aiGCvRU=; b=BcPEkIG2uX/BG29TRtU20AZAJAcDHBvd7n8X2orpJ1VK7LyYrV54t3WLCKQtHI3Lq3 he6YOMBpMHRqkIk0VFAYSrNUC4idcIZ9FJ/g2LfJ1l+V57Ayoz+Q1kfCtu+hxLHd7Sgx bTDpv7nWAe1KvZ0UiIDZ5lWiH+9117MVCBHE4KhQWbqocrYrQReb0elE1OY7Q/BjVrOe d2qBc1+2L96iDBwFDEcGJCPqm/WgDBiwOEEKwApxPHrv5VpJV3Zbey/78X+QzmY8UbbY tV8j+LKwavkpJ3pfbUdjDsXDGb56sQAR2wh7Z5G9tG7rvqXPJZw72i83w/rqFIrXXzUk PktA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MuUKdiJi+CqUOLmeMIpojQqKJ/GoLF/CYoe+aiGCvRU=; b=ltcC7R1ECG03WQ8gU07IZDA6Vmz9ixrgMkJ05i8rG0JZc6kp5qqDU3FzINol3r/wOG Ui3xmDHWUTv5iTUCNsAiVjRq/FCBp/Lx/ppCT5/iAmiiPcAheBEPE2s4zAkyks1MQ+sU OjVaRTu6UllubQ6dTX09H01gbV6GE705Rfscbv8tq9zyqiSjK03VMeDAJcQFKgvteQIP Cj1/LKxbkzOGKLyj0qsruKaublE0H7HwB3tD60VxYdnuTDqU3WPrxux7ZB89ptvlOzw6 UOSmYQPvsrYjEPe7PyGPhYnGmHjMSCfHwtso0SWLB1fyH5hcjXnsA+11zY6ubfFB9ozw 34Qw== X-Gm-Message-State: ACgBeo1IWtw/AfqckN2aWs2aE2mOe1RLv5GVZggW69f6wwY5QCseXvyh /zcfabMe+2MU+WHz6U1SQwY= X-Google-Smtp-Source: AA6agR7YfoIlbxo8CLs9bnehGJow8QNgQ5mui++Ey30il7CQd0i1TJbbeANlW79BbP8P9qo95ZBFWw== X-Received: by 2002:a17:903:28c:b0:16d:cf30:3b71 with SMTP id j12-20020a170903028c00b0016dcf303b71mr4384084plr.165.1659108205120; Fri, 29 Jul 2022 08:23:25 -0700 (PDT) Received: from vultr.guest ([2001:19f0:6001:2912:5400:4ff:fe16:4344]) by smtp.gmail.com with ESMTPSA id b12-20020a1709027e0c00b0016d3a354cffsm3714219plm.89.2022.07.29.08.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 08:23:24 -0700 (PDT) From: Yafang Shao To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, songmuchun@bytedance.com, akpm@linux-foundation.org Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, Yafang Shao Subject: [RFC PATCH bpf-next 02/15] bpf: Use bpf_map_area_free instread of kvfree Date: Fri, 29 Jul 2022 15:23:03 +0000 Message-Id: <20220729152316.58205-3-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220729152316.58205-1-laoar.shao@gmail.com> References: <20220729152316.58205-1-laoar.shao@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659108206; a=rsa-sha256; cv=none; b=dwjAjxeVeAwv6sK6BSOo+zd0Jn7NHPNOhx/ehj/o6K2BFxDMoMCR5vP1s9IOHCUWRZTejB qUdl8oNiqrL99Vge0hS7NO/T6uOmomOUymqURTBCa2Aa7PeGY5/UXYt8u8xHojCXsqyK5D nzWNBC7lxeo9+0NUw9q4Occ7Xk+NHao= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BcPEkIG2; spf=pass (imf11.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659108206; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MuUKdiJi+CqUOLmeMIpojQqKJ/GoLF/CYoe+aiGCvRU=; b=UMuiRvdHA68YpAh/6Pux8WHex1HUGR+zRfij8V4mOIlLNtaZ3jxfhraVPmxq07xCYbW0ia NByGlXFUpA2MZYUGlhL13TmjCcLOQJd95wP7iunLuHVt9kwgXp2WncOTF1OorqEGVjfo5r 9fNxhFQG4YSmUliHcXzz8o3TMwHqirA= X-Rspamd-Queue-Id: 4AE97400D9 X-Rspam-User: X-Stat-Signature: krq4zn1w7d8zzzhdmk87n7cj6mgnqwho Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BcPEkIG2; spf=pass (imf11.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam08 X-HE-Tag: 1659108206-719271 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: bpf_map_area_alloc() should be paired with bpf_map_area_free(). Signed-off-by: Yafang Shao --- kernel/bpf/ringbuf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c index ded4faeca192..3fb54feb39d4 100644 --- a/kernel/bpf/ringbuf.c +++ b/kernel/bpf/ringbuf.c @@ -116,7 +116,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) err_free_pages: for (i = 0; i < nr_pages; i++) __free_page(pages[i]); - kvfree(pages); + bpf_map_area_free(pages); return NULL; } @@ -190,7 +190,7 @@ static void bpf_ringbuf_free(struct bpf_ringbuf *rb) vunmap(rb); for (i = 0; i < nr_pages; i++) __free_page(pages[i]); - kvfree(pages); + bpf_map_area_free(pages); } static void ringbuf_map_free(struct bpf_map *map)