From mboxrd@z Thu Jan 1 00:00:00 1970 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 910DFC83F34 for ; Thu, 17 Jul 2025 16:25:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31C9C8D0005; Thu, 17 Jul 2025 12:25:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F41D8D0001; Thu, 17 Jul 2025 12:25:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2FE8D0005; Thu, 17 Jul 2025 12:25:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0BD418D0001 for ; Thu, 17 Jul 2025 12:25:49 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B232212AD36 for ; Thu, 17 Jul 2025 16:25:48 +0000 (UTC) X-FDA: 83674282776.14.4F85F4F Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf06.hostedemail.com (Postfix) with ESMTP id 92D07180005 for ; Thu, 17 Jul 2025 16:25:46 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BfU5odC5; spf=pass (imf06.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=usamaarif642@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=1752769546; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5EPkM4MV2NqCPptDvx5vWcMgE78ZZptHn3oX5iA9oSM=; b=hhFrJpswZ41yPKO/F/KicBem+I9DfzX9emQ7D/WSMLLceE+m3GNnDexZcZAtaqjLdaiork 3VCRsuG4uWF0M02b4PJXIXZ0265lpxQV/3z2QxKlV9yYuPT5PpzBKKjSIqODDvse38JdJk 6gizhEsYZQHzjxD41emdH+CRICepGYY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BfU5odC5; spf=pass (imf06.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752769546; a=rsa-sha256; cv=none; b=VefFnDCRpAbtduKpdCTL7N0LSQ2eb/hvbeP1IUmLkv0nba3pIAtiKS9iWAymzyoxjbFzmJ WQlD2Pqn5GhS+NeQx/bwLXoTKqxdSHBMtsfe6OGClLJIiBaxTsfGteMnK/I3x04K9SZzjj nll5vHIfOcXkC6l8q0izUC+xN9jIlOA= Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-ae0de0c03e9so177235866b.2 for ; Thu, 17 Jul 2025 09:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752769545; x=1753374345; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=5EPkM4MV2NqCPptDvx5vWcMgE78ZZptHn3oX5iA9oSM=; b=BfU5odC5xNX160iQii25HmmwkAeDoHPHtr2vlF9+UyIzsFfRoLOlEFKc6LUz1UTFzM olZoCFiaZ3ncm+1yIyxxyOopSNIu9BF5cysb7TvWIMzuPIx/QFByfZhzYDcpSTcB/Znl hZp8EoDfPunnehbS4R4skVtO8gfqQPlTeP50CxyPHb4AHUKhdLRmIs2uL0l3UnpwQfRm r25mah1ISUJsOhwWflR4VFeCdej0c76clxrNdVdZ28btMP3s+TFIPPgDHvAIUi1nVuQk dQbH1oJRBwAJyEiW2eyGwQjhtt6Fhbv4spkiaIdu7jWUx+YTj1qV+aDV+Uc1xJZWelFb ahyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752769545; x=1753374345; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5EPkM4MV2NqCPptDvx5vWcMgE78ZZptHn3oX5iA9oSM=; b=gv80xao8UwnJBvxCziWwES0LhfcvJktv0cHMDP1ndPkijlfeDS/DfFjm8edqWb87xo hFfnfEDyYrIbu+Md/QWhTVSEXvkEgrXBiD2zelzbTjHRV49uI6bIJqcdYSHNUPE8AX5g 8mMjFZz9zYa/4QUr/jmhIfU1CiZv75Zx0ZNgW6VzVCXDhmJbQDBVC9N1yNPHSKvlS4yG TxhImAsPp06WDKKIL4YiBSeneIDFAb3oNdwU3GsdwKncFG2mkJ25/o4vGUg/zDs9XK9a NucxUlnMM2AqteXHYfvqVpBM+HJpI98qE3Hqedwh1Hrhcl5uzSjBCiE7ymTyxLe+JQtK LVIA== X-Forwarded-Encrypted: i=1; AJvYcCWY8ct21PPvju+pJsv2Xg2hfjfGeIo8mSnB2htw/xt5pl/FTg5SBONRVmYrdJY6tOSWYeWEr+JxlA==@kvack.org X-Gm-Message-State: AOJu0YyHhOThd3h7LQDYq3pbHr7QR3KpfOPDpxy4DZw3oEhBHamjzfWg Ot4t2X3gyADJ5GfTDXFdmUeoKqgBfsGwYabiI8A/62RXlUwLOdcj3qZx X-Gm-Gg: ASbGnctHNc6Rqdtj/Ffylm9/23x1bnmpZamM0hUrG4wCJVkoz4jPyFWSxNc79spiSZY 34j/HcKsNPSzghM2c2+OqABuWAIvk2v3jRSncMyyqEHOMyWj4ZCjX1yR7NPgT6bS7wxjOJj/zEe LORAyjCkk4lb+Bkhd1EvJ7WfJfeJPqTgjYPtDJRwwOws59DZ7CvrbAlB0P8QHshHom5vQJvfsmp eal3PE/z77NoM+vPsfN320eupimTT/Fgl59OQde8vVHJfyjFltH14WF8mFqr5OV/Az3OPYEMvlW Vagl368OpN9P1wpgcooroG0LNxBI78ZbZKHSXJjr+ONCNrMg+w5s/bjCQ1glyHBS3dVbkxv1Yl4 V6/rFQ5wfwPNIZNo+pFM5qJpeJ6ne3lbdBf/pnH7hVPfCn6DZf0A3gTYB6rMtALERGM7q+mI= X-Google-Smtp-Source: AGHT+IHeLcr1pBbKBFA1pU6Brp5R8o8KUPnlWlbjIIlH4I6mN0jgJFRhVmH47BFgYKizmcvJjONjqA== X-Received: by 2002:a17:907:9809:b0:ae0:b22a:29b4 with SMTP id a640c23a62f3a-ae9c9ac18c2mr754671866b.39.1752769544566; Thu, 17 Jul 2025 09:25:44 -0700 (PDT) Received: from ?IPV6:2a03:83e0:1126:4:14f1:c189:9748:5e5a? ([2620:10d:c092:500::7:8a92]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae6e7e90a16sm1378047466b.24.2025.07.17.09.25.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Jul 2025 09:25:43 -0700 (PDT) Message-ID: Date: Thu, 17 Jul 2025 17:25:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 4/5] mm: thp: add bpf thp struct ops To: Yafang Shao , akpm@linux-foundation.org, david@redhat.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, hannes@cmpxchg.org, gutierrez.asier@huawei-partners.com, willy@infradead.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org Cc: bpf@vger.kernel.org, linux-mm@kvack.org References: <20250608073516.22415-1-laoar.shao@gmail.com> <20250608073516.22415-5-laoar.shao@gmail.com> Content-Language: en-US From: Usama Arif In-Reply-To: <20250608073516.22415-5-laoar.shao@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: cpwhw1sj5r99hntwkemig46uky1q1nod X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 92D07180005 X-Rspam-User: X-HE-Tag: 1752769546-19718 X-HE-Meta: U2FsdGVkX18mILBchQ2TnuuVndh8dIWJr7PgGUelvvfkwLvsTthIxmafs2n3i5FO6oOl3DCnkJ+jy45AxQHGd7aUk6uRRqRXaG7U61ZsXHoEI5zBvfzqifiSivF9UAzZKCkknTXc3FxURFJtOggMa2fzzNRPu9YxoLVpNmvvCeFBqXRTIZB405Aza/M0fXPd3ISKEgEOwUvhXsCfIhPB8i0oW77D7lNI1fOEK/sLZTjbmKeYwNtS/QkQZwvL5jmIGpQzErPQ/YWSzq0ooOW+ciXi7YRPI+KtNVZxTetQCcDWh+TzRrDduwwf/6kALA+NMNRZqwsk6wzO6hgvpG3iD4v+xEFj81RfcRgqbF1Sj8ST9TllWZ1tMgta3YFF2EGfsadJcdPJ5iUkguqaNl050TdlM/sN4Gxv42IroYoP4W8Ak584CjHZcTdiNK7t4IJveUqTmVGbzPUt6PR/DYU6jtgz9EqBN7MMN/vJehzvf9buOLl5QsVh25T8VIOmkof2gMZ59nctn7ckFA9pLvS1R8JnMyutfheHpoXxwbJ1guOCBG0SybTa0IyLi7qc2wl3znsDyrLzfUpu2Itb6UWB87SsmAekqd5/zSiZu6zF5zfIcC3t3Ws/UL3c6SwkFQdap3B4/BTwBUNlY7Abaodgj9LFFYV7slOnqsikgHQip0pFO3221Ey661YgywBXaYNjfhx7rXCQ6nQfyQvd7vDfJMueb9hNs1EXm95oB3het0lt/PTRYIc13z5zdbLxStxLAnfVyoRWmpKozfHOwZ82YfA/FmKypz2Ja6dSy07wkZE7VA/EyNZHeWIlqdvxcwEc8iHikK6EcNfFWwJhTvHmtPQQgz5bK7KeL0d8BRMCb/saUwO6TJ+Fqe1u2ugc0xr/g1LLBiaBq9E/u13h9aNz6+JMu1K64Uza2OC7TLaXaBE2SP3jbEAdEe+1XbVUK7rHqIwv9omgWTfJKFgpAcj Y7ZKkItk gKPEJYCIzvBHNB3fBUH9nIECuCakifzva6DREJb7kw8kuSRipMiLS7EqVnDTw9XmBqkJ5VUyajMmb9Zp/HinSh9kY9hohIwRA6oLy1D0ji/v/W0I8/sHgIvAD/xRYudUmhZiLNRe2MWOXPxvamT4rvK0lFy2XU4kb8JB3ac0DtjeJoNdGCmesjFxGI38BQw9AdNztSMLb6Y+/e1l3ZoDe9WSMiQUIUeWxG4grhMl+SoYVzdep5DDgBcIUpFilGSCjoqrpvHyaY1kUnarcKi9F2Ca7Vx2c/F8pDpGyH0LtxA3ISv/681bBT7R/wHgAWh1Zp+kmHo7ihyjN0aZGOHRVupdLs4dtH+oDd+77oVoRzQxRiZE1j6MiaZzNC2d2SRN5xhWtplHWWY0gkPzP2tXGJ0nXixOQoNLzrYsqwNUgoflKkFRkR80HzuKtYphYlbREUXgFuKy65q7ZZwEr4wm8y0In115RRXc3DQtvbm78DHsL79MzBQTtkg5bMtqRhtWteQFp1mRdqUTDQsN8dAyTpYKd1oyRahu/BpbQxbnFPG9HAucHyHB13CEvOh7LiBPIabCP/0zD/yvw0FUoS1zWUjnDTr4uSkvSEOjz 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: List-Subscribe: List-Unsubscribe: On 08/06/2025 08:35, Yafang Shao wrote: > A new bpf_thp struct ops is introduced to provide finer-grained control > over THP allocation policy. The struct ops includes two APIs for > determining the THP allocator and reclaimer behavior: > > - THP allocator > > int (*allocator)(unsigned long vm_flags, unsigned long tva_flags); > > The BPF program returns either THP_ALLOC_CURRENT or THP_ALLOC_KHUGEPAGED, > indicating whether THP allocation should be performed synchronously > (current task) or asynchronously (khugepaged). > > The decision is based on the current task context, VMA flags, and TVA > flags. > > - THP reclaimer > > int (*reclaimer)(bool vma_madvised); > > The BPF program returns either RECLAIMER_CURRENT or RECLAIMER_KSWAPD, > determining whether memory reclamation is handled by the current task or > kswapd. > > The decision depends on the current task and VMA flags. > > Signed-off-by: Yafang Shao > --- > include/linux/huge_mm.h | 13 +-- > mm/Makefile | 3 + > mm/bpf_thp.c | 184 ++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 190 insertions(+), 10 deletions(-) > create mode 100644 mm/bpf_thp.c > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 6a40ebf25f5c..0d02c9b56a85 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -54,6 +54,7 @@ enum transparent_hugepage_flag { > TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, > TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, > TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG, > + TRANSPARENT_HUGEPAGE_BPF_ATTACHED, /* BPF prog is attached */ > }; > > struct kobject; > @@ -192,16 +193,8 @@ static inline bool hugepage_global_always(void) > > #define THP_ALLOC_KHUGEPAGED (1 << 1) > #define THP_ALLOC_CURRENT (1 << 2) > -static inline int bpf_thp_allocator(unsigned long vm_flags, > - unsigned long tva_flags) > -{ > - return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; > -} > - > -static inline gfp_t bpf_thp_gfp_mask(bool vma_madvised) > -{ > - return 0; > -} It makes it quite confusing for review to add code in earlier patches and remove it here. I dont think you should have had the first 3 patches? and the code is mostly in this patch? > +int bpf_thp_allocator(unsigned long vm_flags, unsigned long tva_flags); > +gfp_t bpf_thp_gfp_mask(bool vma_madvised); > > static inline int highest_order(unsigned long orders) > { > diff --git a/mm/Makefile b/mm/Makefile > index 1a7a11d4933d..e5f41cf3fd61 100644 > --- a/mm/Makefile > +++ b/mm/Makefile > @@ -99,6 +99,9 @@ obj-$(CONFIG_MIGRATION) += migrate.o > obj-$(CONFIG_NUMA) += memory-tiers.o > obj-$(CONFIG_DEVICE_MIGRATION) += migrate_device.o > obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o > +ifdef CONFIG_BPF_SYSCALL > +obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += bpf_thp.o > +endif > obj-$(CONFIG_PAGE_COUNTER) += page_counter.o > obj-$(CONFIG_MEMCG_V1) += memcontrol-v1.o > obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o > diff --git a/mm/bpf_thp.c b/mm/bpf_thp.c > new file mode 100644 > index 000000000000..894d6cb93107 > --- /dev/null > +++ b/mm/bpf_thp.c > @@ -0,0 +1,184 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include > +#include > +#include > +#include > + > +#define RECLAIMER_CURRENT (1 << 1) > +#define RECLAIMER_KSWAPD (1 << 2) > +#define RECLAIMER_BOTH (RECLAIMER_CURRENT | RECLAIMER_KSWAPD) > + > +struct bpf_thp_ops { > + /** > + * @allocator: Specifies whether the THP allocation is performed > + * by the current task or by khugepaged. > + * @vm_flags: Flags for the VMA in the current allocation context > + * @tva_flags: Flags for the TVA in the current allocation context > + * > + * Rerurn: > + * - THP_ALLOC_CURRENT: THP was allocated synchronously by the calling > + * task's context. > + * - THP_ALLOC_KHUGEPAGED: THP was allocated asynchronously by the > + * khugepaged kernel thread. > + * - 0: THP allocation is disallowed in the current context. > + */ > + int (*allocator)(unsigned long vm_flags, unsigned long tva_flags); > + /** > + * @reclaimer: Specifies the entity performing page reclaim: > + * - current task context > + * - kswapd > + * - none (no reclaim) > + * @vma_madvised: MADV flags for this VMA (e.g., MADV_HUGEPAGE, MADV_NOHUGEPAGE) > + * > + * Return: > + * - RECLAIMER_CURRENT: Direct reclaim by the current task if THP > + * allocation fails. > + * - RECLAIMER_KSWAPD: Wake kswapd to reclaim memory if THP allocation fails. > + * - RECLAIMER_ALL: Both current and kswapd will perform the reclaim > + * - 0: No reclaim will be attempted. > + */ > + int (*reclaimer)(bool vma_madvised); > +}; > + > +static struct bpf_thp_ops bpf_thp; > + > +int bpf_thp_allocator(unsigned long vm_flags, unsigned long tva_flags) > +{ > + int allocator; > + > + /* No BPF program is attached */ > + if (!(transparent_hugepage_flags & (1< + return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; > + > + if (current_is_khugepaged()) > + return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; > + if (!bpf_thp.allocator) > + return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; Probably make it if (current_is_khugepaged() || !bpf_thp.allocator) return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; > + > + allocator = bpf_thp.allocator(vm_flags, tva_flags); > + if (!allocator) > + return 0; > + /* invalid return value */ > + if (allocator & ~(THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT)) > + return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT; > + return allocator; > +} > + > +gfp_t bpf_thp_gfp_mask(bool vma_madvised) > +{ > + int reclaimer; > + > + if (!(transparent_hugepage_flags & (1< + return 0; > + > + if (!bpf_thp.reclaimer) > + return 0; > + > + reclaimer = bpf_thp.reclaimer(vma_madvised); > + switch (reclaimer) { > + case RECLAIMER_CURRENT: > + return GFP_TRANSHUGE | __GFP_NORETRY; > + case RECLAIMER_KSWAPD: > + return GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM; > + case RECLAIMER_BOTH: > + return GFP_TRANSHUGE | __GFP_KSWAPD_RECLAIM | __GFP_NORETRY; > + default: > + return 0; maybe you let the userspace decide GFP flags instead of having RECLAIMER_xyz? > + } > +} > + > +static bool bpf_thp_ops_is_valid_access(int off, int size, > + enum bpf_access_type type, > + const struct bpf_prog *prog, > + struct bpf_insn_access_aux *info) > +{ > + return bpf_tracing_btf_ctx_access(off, size, type, prog, info); > +} > + > +static const struct bpf_func_proto * > +bpf_thp_get_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) > +{ > + return bpf_base_func_proto(func_id, prog); > +} > + > +static const struct bpf_verifier_ops thp_bpf_verifier_ops = { > + .get_func_proto = bpf_thp_get_func_proto, > + .is_valid_access = bpf_thp_ops_is_valid_access, > +}; > + > +static int bpf_thp_reg(void *kdata, struct bpf_link *link) > +{ > + struct bpf_thp_ops *ops = kdata; > + > + /* TODO: add support for multiple attaches */ > + if (test_and_set_bit(TRANSPARENT_HUGEPAGE_BPF_ATTACHED, > + &transparent_hugepage_flags)) > + return -EOPNOTSUPP; > + bpf_thp.allocator = ops->allocator; > + bpf_thp.reclaimer = ops->reclaimer; > + return 0; > +} > + > +static void bpf_thp_unreg(void *kdata, struct bpf_link *link) > +{ > + clear_bit(TRANSPARENT_HUGEPAGE_BPF_ATTACHED, &transparent_hugepage_flags); > + bpf_thp.allocator = NULL; > + bpf_thp.reclaimer = NULL; > +} > + > +static int bpf_thp_check_member(const struct btf_type *t, > + const struct btf_member *member, > + const struct bpf_prog *prog) > +{ > + return 0; > +} > + > +static int bpf_thp_init_member(const struct btf_type *t, > + const struct btf_member *member, > + void *kdata, const void *udata) > +{ > + return 0; > +} > + > +static int bpf_thp_init(struct btf *btf) > +{ > + return 0; > +} > + > +static int allocator(unsigned long vm_flags, unsigned long tva_flags) > +{ > + return 0; > +} > + > +static int reclaimer(bool vma_madvised) > +{ > + return 0; > +} > + > +static struct bpf_thp_ops __bpf_thp_ops = { > + .allocator = allocator, > + .reclaimer = reclaimer, > +}; > + > +static struct bpf_struct_ops bpf_bpf_thp_ops = { > + .verifier_ops = &thp_bpf_verifier_ops, > + .init = bpf_thp_init, > + .check_member = bpf_thp_check_member, > + .init_member = bpf_thp_init_member, > + .reg = bpf_thp_reg, > + .unreg = bpf_thp_unreg, > + .name = "bpf_thp_ops", > + .cfi_stubs = &__bpf_thp_ops, > + .owner = THIS_MODULE, > +}; > + > +static int __init bpf_thp_ops_init(void) > +{ > + int err = register_bpf_struct_ops(&bpf_bpf_thp_ops, bpf_thp_ops); > + > + if (err) > + pr_err("bpf_thp: Failed to register struct_ops (%d)\n", err); > + return err; > +} > +late_initcall(bpf_thp_ops_init);