Message ID | 20230112155326.26902-6-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 6BACCC54EBC for <linux-mm@archiver.kernel.org>; Thu, 12 Jan 2023 16:00:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 017DD8E0002; Thu, 12 Jan 2023 11:00:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0A128E0001; Thu, 12 Jan 2023 11:00:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD1CA8E0002; Thu, 12 Jan 2023 11:00:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CD24B8E0001 for <linux-mm@kvack.org>; Thu, 12 Jan 2023 11:00:10 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 33B1F1208B3 for <linux-mm@kvack.org>; Thu, 12 Jan 2023 16:00:10 +0000 (UTC) X-FDA: 80346608580.22.7DED1FF Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by imf03.hostedemail.com (Postfix) with ESMTP id 6197A2001A for <linux-mm@kvack.org>; Thu, 12 Jan 2023 16:00:08 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IZZcCnX8; spf=pass (imf03.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.221.175 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=1673539208; 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=e5Uabr6rMB0Xp+uFEKRqPdRCxhNWiBeN0NwYKLeAixU=; b=YtokODqOJc/xZxjaPdua0z51abB6bsyzKHU60M8aMptuBa5wKrCm3s+fuQxuzw6hqmcswk vmO2PzKzMAjDk7cItHe5LGkw3XOj1eRKt4JEpjRFXNwyCtGg2IPi8z92Ik2ZDs3pSFuUf5 NZ+phStNYi8mooEAJh/vwBepvsWEeTw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IZZcCnX8; spf=pass (imf03.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.221.175 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673539208; a=rsa-sha256; cv=none; b=SqvLmAIUSxx7GYemJGLperALTkCgEZqQUMsDm14B87JHASu0uTSRS2dEaW0zNS0mEAW4x8 NTCM6hhkrKvM6edY8VeGzE+AsqW/ncZEwkVm7VL2kKGBMhD68TVKDRsiHf6SBJByTsGJrI MvS9z+YJa9cSxl8TX+Vo8jP0xcLHKbI= Received: by mail-vk1-f175.google.com with SMTP id v81so8944712vkv.5 for <linux-mm@kvack.org>; Thu, 12 Jan 2023 08:00:08 -0800 (PST) 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:subject:date :message-id:reply-to; bh=e5Uabr6rMB0Xp+uFEKRqPdRCxhNWiBeN0NwYKLeAixU=; b=IZZcCnX8wvwbpWe4gRFRcNAA8cfuZZ0wsr6T2tk5JqzyUrWoECk/4yqCErfaMsazk6 N7DKy/pwRR8tik0IPz2om2ZlUpPenM3WYjJKSGh/XM0KWou/YEj178TroQUGudA3Gr/0 A+wXOR5mzYBFFtuLD/Xyosv98vs84h0GPrJUuURrbn0BVmnGez0uawzzxWR/bhJ3jYWF oncdliudHrevq3hyfaG8LM68B4V9wn4EXhKt8v+tGioF2P21ja/ntPiVXqNgI3SYQF1m hXMe2o3dK6RgqFDyGs5TPySYbn19i6IgD2uZok0X+D/OLeRK3WA7uktdtx5xsJDT4zhY ZcUQ== 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 :subject:date:message-id:reply-to; bh=e5Uabr6rMB0Xp+uFEKRqPdRCxhNWiBeN0NwYKLeAixU=; b=wk73exWFW5b9xhqs6PC8U/8GSgQe9MB9IZT6A9RcpWTdCNbm8HxfldZJx/ksQ8ZxTm YErUBV6Q5pKtoSWWEopGICW4U1BOz0me7U74+7Rwf0wklhLtkABO5VmOQDH4c0rgAa9J 8jNAjheBUYtStb1oTFJARrz9vfYKNhK5/h4PtTiUr/lLkq+xrpH7TAwKJBGvstVMDMOa nBaRVPz7TtvFLAcrzaENe4cPvwmiLbciOXHkhwFmjoT3mgSuiyggNfINU9ki6vt6i+8z c8pgNSkydjCiMtgiq2cFMHrixTCJMV6r3i17+zedOHks8bp7KyDYY4JC/zgOoq5KZ+sB 0nvg== X-Gm-Message-State: AFqh2kpIr0HZQGyWudoQN0XHGG3vyf6OkrD71JdT0Cx5DVboJyL3Yboa I/sQ8ecE216vkhYRNyiIAjJZNdusQeaLcj1KarU= X-Google-Smtp-Source: AMrXdXteMaFBBBox4hoGYeP7OQ1QSvsy+19+ts6oymG9XgnQ4GKqRTiAV+vZ7JEEP0SB0OSyUI7vXQ== X-Received: by 2002:ac8:5197:0:b0:3ac:940c:6a6c with SMTP id c23-20020ac85197000000b003ac940c6a6cmr22208861qtn.34.1673538820190; Thu, 12 Jan 2023 07:53:40 -0800 (PST) Received: from vultr.guest ([173.199.122.241]) by smtp.gmail.com with ESMTPSA id l17-20020ac848d1000000b003ab43dabfb1sm9280836qtr.55.2023.01.12.07.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jan 2023 07:53:39 -0800 (PST) From: Yafang Shao <laoar.shao@gmail.com> To: 42.hyeyoo@gmail.com, vbabka@suse.cz, 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, tj@kernel.org, dennis@kernel.org, cl@linux.com, akpm@linux-foundation.org, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, roman.gushchin@linux.dev Cc: linux-mm@kvack.org, bpf@vger.kernel.org, Yafang Shao <laoar.shao@gmail.com> Subject: [RFC PATCH bpf-next v2 05/11] mm: vmalloc: introduce vsize() Date: Thu, 12 Jan 2023 15:53:20 +0000 Message-Id: <20230112155326.26902-6-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230112155326.26902-1-laoar.shao@gmail.com> References: <20230112155326.26902-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6197A2001A X-Stat-Signature: 47q8fkbkbm8kr9toxt7x5zzpqnfuamo7 X-HE-Tag: 1673539208-866253 X-HE-Meta: U2FsdGVkX1+0ju327erm4h8QJorWjsmjHjJ/t09F3j/mAXCIQ/81wOQtCST1yweV1dDEsd0RT2bvQBD+5jm+6qvlPQeSSJbkzQiW73cRUUKVymqdWcWWcB36o/XYXVgENKwam0g3uCnWH7lWoRyTihWaJl0uls/3ckCUPLDhXnoLyOv+lTHQrrtCmet1hqtOQ/E9lK2ZAUUB9OtFsRekHdl+gvf+baf4S8dGdCiWmx1pXWo1oJLbvUKPbvecznGsGupea/Uby6D8pLqRpbg/6UyMI66DnP/z3+GTKSE1ceWHa39flbrba4zKKyx9vmekE5xVvrBEZNpnO9Pld7zztH161/RentZbCOscxtnO3DnR+j0W8q711w/V7rtb/sND9yuRomFjjYo4P384LCrHgha8NJ8Bx7Tu29l4RDBbZ7T+F5br38P504pJlBDnUfLT8DXXzyiMvLt7ZkQWrw5drspwx2V+LRxy4tcoZYxO5s5xCU8RdHuyS/gr/arQaRAKJVB6RWErk5HHer6WRUKlFFr49hhcROyoMEWBSvck6Dx3rVdx9dLaS/L2yz6NCzY7R0QTwluPiht74q4TyZ1gqk5voNX9QP/+tVFtNkrrAFBc1LKBMnDWLJT1vkPBxm0IV5uC8AR2lFs8SKATOsipOP70jgr0nZHnAkNrfbW3fTQxwZB8RJ0TQK6yceqOKGApSfSo/whe9p7GTb6lL5gb1jXVk6X6wnXC2IgbdPy/DP0SU44V36QKuN3Qgve44Kfar9l898Ny/nZ1S7dXzLCavWijm8H1ddRUkLuk225W+j+OfZa7WWPP2Hl7pgqs0CJqDNAfOTnvxoojtxinzpW96zZcKe0BrYZsgs4LheA3I0WH1ylET36BiODUXBRSQJshajbeG3PTIk/aItLZIkj4togXmSDwcEACG0W79lfK96UrtPNoNTc3+HkVWubTK9RTpaCXeur9Et1osCJKb0q BXs2PHfT mTi3XOdskMJERTF7Dxp2ESVlJA9ATO8vArFus7O0O3k6qEnhNGAMKNht24vB1CYjn1rRgBZxdD5mNJ9I4THQ8pyvQSP3LgGzozrBDAL+acIe/Mo2IF32AqpfWyScKKoGndilRvqjufVNOBY4j9/vP8TMgP+fr0D0Lk0UyeV/hoBIwcam9BiAKvICBD2ruqNA1a1nBYr6JVy/8uQnuBCW2731kThNgdljPlCVX0lCyCQopF2o= 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: <linux-mm.kvack.org> |
Series |
mm, bpf: Add BPF into /proc/meminfo
|
expand
|
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 096d48a..52f925f 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -297,4 +297,19 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets, static inline bool vmalloc_dump_obj(void *object) { return false; } #endif +/* Report full size of underlying allocation of a vmalloc'ed addr */ +static inline size_t vsize(const void *addr) +{ + struct vm_struct *area; + + if (!addr) + return 0; + + area = find_vm_area(addr); + if (unlikely(!area)) + return 0; + + return area->size; +} + #endif /* _LINUX_VMALLOC_H */
Introduce a helper to report full size of underlying allocation of a vmalloc'ed address. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> --- include/linux/vmalloc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)