From patchwork Wed Aug 10 15:13:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12940644 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 2F0DCC00140 for ; Wed, 10 Aug 2022 15:13:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C0426B0072; Wed, 10 Aug 2022 11:13:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBDC66B0075; Wed, 10 Aug 2022 11:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE7E58E0001; Wed, 10 Aug 2022 11:13:40 -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 ADC4C6B0074 for ; Wed, 10 Aug 2022 11:13:40 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 71AA5141441 for ; Wed, 10 Aug 2022 15:13:40 +0000 (UTC) X-FDA: 79784027400.04.D8CA0E9 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf22.hostedemail.com (Postfix) with ESMTP id 7EAB4C014F for ; Wed, 10 Aug 2022 15:13:38 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id x10so14518372plb.3 for ; Wed, 10 Aug 2022 08:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=iWaAjku+9DHBSIX7N6Ue4B+MVNq84IC+6QjMUqI3TB0=; b=Z/lxRlLLd8aSOe7UrBVwtoZHysAGXWomvjXyaFiZjFlvg93dIiptrkIXqv7ZwATWu0 qmjE8r7cc/WvmiTKV+QUmKKhDeZBxCQImUyh6qwf024lOWsEmiD1tW6FuaqxYYp+xzK6 kTiufGpumO4QQfOIiLh5ufB04SP5x8A1yXYEkUDyvDt3Bbly58OvgpZLhHQMSsZRK+QT n43tXwQyR1Lqrc5tp0nA+txpiYYEJqZX/++kbwD6RoUwxLpbAspZf9G0FVsLtgKID2PL nOVBKuClxVqbojihSI6uXE8Z8bDAhvPWm2TuwGiLhLqSVzaFHhfj3zVQc8Su3JkZtfvX PcUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=iWaAjku+9DHBSIX7N6Ue4B+MVNq84IC+6QjMUqI3TB0=; b=Jl0PiZoIc7FxD4Ho/cl2pNCz7rtG7nlJPECs+5iEO9Lq51oVZI+Xx3ssX4jIPHK7Pt LS9LJlW7fZzbcum//lcGLhp6BvlETTLVD17mLfKA8rXo5MHlD9F9FhVq22BRgT7z1OjL un9tT6TtNEPuomXb5q7rlNN1z1adqMsiKwCkwvbigG24kTyVx8dMQp/prZeqvw8nQPgr q9jGbM4oFViFghMJ31Htx/dqiYl0OrpeWLpLAVbFZz933oT8cRNc70OMllFCy0tzYFrk IsBPFw0IfS5yDo9o1u1f36DsHVSnJyi1l1uq9bfpAU3O9P68sSGqO+Gr42H5E5AIuF4+ uxvw== X-Gm-Message-State: ACgBeo2pfbYhFizix1rUSh/sozV7oOuUEvZYhgnhLfpm45bzRfrwP8Dw 1jXwfIOWo9WbcpG5R0/5Apg= X-Google-Smtp-Source: AA6agR7n6vB1/D/uiMiv2j4fpjbh4qX+3s9kpMgqeuuspi0f2HG/KHRnTeGlLwIId1ZR6ew82E87sA== X-Received: by 2002:a17:902:c7c4:b0:16e:d968:6343 with SMTP id r4-20020a170902c7c400b0016ed9686343mr28264299pla.133.1660144417101; Wed, 10 Aug 2022 08:13:37 -0700 (PDT) Received: from vultr.guest ([2001:19f0:6001:5c3e:5400:4ff:fe19:c3bc]) by smtp.gmail.com with ESMTPSA id n129-20020a622787000000b0052dcbd87ae8sm2118339pfn.25.2022.08.10.08.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:13:36 -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: [PATCH 01/15] bpf: Remove unneeded memset in queue_stack_map creation Date: Wed, 10 Aug 2022 15:13:08 +0000 Message-Id: <20220810151322.16163-2-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220810151322.16163-1-laoar.shao@gmail.com> References: <20220810151322.16163-1-laoar.shao@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660144419; a=rsa-sha256; cv=none; b=D/fJccw2AlbQE8LDHRVgjKomW+MpBVGeKZm2QVmLrdZNX/6WD2ArNO4r+wmFeRbnnukjTC klTcCijMlXqJy44vZE1015KwUxkpG1kNoA9Wgi3158U5XHyNt1mnuygpdt2BPinFcdK4Mk DxUcaYUrFNNhJGkXOW9pAL2UDbDKp+s= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Z/lxRlLL"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660144419; 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=iWaAjku+9DHBSIX7N6Ue4B+MVNq84IC+6QjMUqI3TB0=; b=uL6gTwaMBNi4gLYTtbPFruDpXRAgjQA5S0NSDI9jE3YdTwySF0gt+nLOsh5o0Y9ZyDbuNA 355WhammlaZFw2SJmDUY5RSsitYw4U1dmEkc8EnXR4scYJ1u8lNBk7xDZHG35eQn7VaQGi iHfy8GNdrtrqS7rALShD1geyUqaKfA0= X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Z/lxRlLL"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7EAB4C014F X-Stat-Signature: 6x5jmejpbawpnip5muwrkrf75yrtqp4d X-HE-Tag: 1660144418-975481 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: __GFP_ZERO will clear the memory, so we don't need to memset it. Signed-off-by: Yafang Shao --- kernel/bpf/queue_stack_maps.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/bpf/queue_stack_maps.c b/kernel/bpf/queue_stack_maps.c index a1c0794..8a5e060 100644 --- a/kernel/bpf/queue_stack_maps.c +++ b/kernel/bpf/queue_stack_maps.c @@ -78,8 +78,6 @@ static struct bpf_map *queue_stack_map_alloc(union bpf_attr *attr) if (!qs) return ERR_PTR(-ENOMEM); - memset(qs, 0, sizeof(*qs)); - bpf_map_init_from_attr(&qs->map, attr); qs->size = size; From patchwork Wed Aug 10 15:13:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 12940643 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 6293EC19F2A for ; Wed, 10 Aug 2022 15:13:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB2EE6B0073; Wed, 10 Aug 2022 11:13:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D35DC6B0072; Wed, 10 Aug 2022 11:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B20776B0075; Wed, 10 Aug 2022 11:13:40 -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 A0AEA6B0072 for ; Wed, 10 Aug 2022 11:13:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8158340671 for ; Wed, 10 Aug 2022 15:13:40 +0000 (UTC) X-FDA: 79784027400.17.0461C58 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf27.hostedemail.com (Postfix) with ESMTP id 1BC1B40189 for ; Wed, 10 Aug 2022 15:13:39 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id t22so15074485pjy.1 for ; Wed, 10 Aug 2022 08:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=0qneriZlJB8MgUasF3oViKnlhzvyQw+rN/9EeLAKF4M=; b=R7MppX/LJp8q0RKutvpSAAyEnnZfDb/hNLpNOu4qcHHLHj3gw8OL83s+M3Rkqt3UG6 d3OWZ1El3DWSp7LpFOhkqLZ9HSdTkozYp//LR4Gprh2vOVCVrZy1g+bhuBqvksU7hfWT WTnP6F/W9d+8wIefTbDFI7FSHePZpN9Kr0YqlInyWXwFXgRCX/cEg/El/s+1dsCjOaLg eRYj/tAF7cud45vceu2yUBp6whspLzHGO/kIeeYNVEn5Jdb8KL0i+gsmNeqpDa6Ix5tz MExvZtaOY+AXp6jsYsXPWCXlnMg6Dtz+jGt98z8Gejg9mz/UbIethqH0OuhDi+demmSs tatA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=0qneriZlJB8MgUasF3oViKnlhzvyQw+rN/9EeLAKF4M=; b=mG4XgtBWzXKkxjmuAFjBBOJxz9AzjRpWsKH/DZgyxOBov4IkuTh6I2KFtgjH4cjneA YNHvOnr2TgH5vn9UXde+OfwespLXPd9O8YqSq8AWR4LqFq54GspQZqGhLdGmnv4MSnG4 IAf9963peYqse9w8dM5NphuAMNY7jt42Ri1fE9OGdXKyIX4GSyRjBzWFJhtPsxohJeb1 Qe/wB8DGS2Mzgc8Heeml0PYO6lmJ2oY8VmuLoAJcKRgtSqhmH+Qgsm8MKXSS76XlHKJ/ LUFjtybJm9e4EMolhXo5GSgU7Vx18H7jhfbLifvFGvr3Ub/RzIk3dNGnCjL1N/gJDDex QPOQ== X-Gm-Message-State: ACgBeo0xQ99kv+CYuE8yoyFsodhN6AfEcrp3XqSBCxrKHDgR65W2wdCF ASyGkR/+avV6i6p4/ooJj0w= X-Google-Smtp-Source: AA6agR7+Tqvw4GXolynW6mNnDZmfLbkdWXVkZ0+qHlhaNA4u95o9WJMrZ+tYgo7lEet1uyaSfnGkow== X-Received: by 2002:a17:902:f7c6:b0:16d:c795:d43e with SMTP id h6-20020a170902f7c600b0016dc795d43emr28633657plw.162.1660144419219; Wed, 10 Aug 2022 08:13:39 -0700 (PDT) Received: from vultr.guest ([2001:19f0:6001:5c3e:5400:4ff:fe19:c3bc]) by smtp.gmail.com with ESMTPSA id n129-20020a622787000000b0052dcbd87ae8sm2118339pfn.25.2022.08.10.08.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:13:38 -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: [PATCH 02/15] bpf: Use bpf_map_area_free instread of kvfree Date: Wed, 10 Aug 2022 15:13:09 +0000 Message-Id: <20220810151322.16163-3-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220810151322.16163-1-laoar.shao@gmail.com> References: <20220810151322.16163-1-laoar.shao@gmail.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660144420; 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=0qneriZlJB8MgUasF3oViKnlhzvyQw+rN/9EeLAKF4M=; b=zm4G9a4NKR+0lZHSX96PeZZtemkap2TlCWCNP4QfaTJeOUCh+up68NZ6kMPNv5bYlseNgw qoCKOAZpXpUfA1LfqOnWoe0SNc42xmeg/0nh0l8FHqmT6wD+X33O4vX4p8J4SSGtHHcakh SKcheZlcy11oVlbHaN3ZVpwhmdy7D8k= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="R7MppX/L"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660144420; a=rsa-sha256; cv=none; b=lQsjy554/bkKnyRi3o4TRqeIetwMTJdvRZiVMKY2ZhigSAKFBGra70c5LKgueTTlkdzZQN 3+3YTtZxxqhoWMaE++An0TOcGTvrJ+SSqxK8W5+7oFPsW3nfRWvxdU23BQBAxAJi78ka9I JjaWlE5jc0ZcFpjdboc1LS7akkdiJCY= X-Stat-Signature: x9yb5jt8bdj6hwkhbbaqi5j48ua4im18 X-Rspamd-Queue-Id: 1BC1B40189 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="R7MppX/L"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1660144419-372611 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 ded4fae..3fb54fe 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)