Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp392008rwr; Thu, 20 Apr 2023 00:29:10 -0700 (PDT) X-Google-Smtp-Source: AKy350YhAbB3aN6fkW8oFzm9xmzCFDSIXgtWYi5D4TBF4IhyUDcKEoWQ5S0SUkzlwQYSEUT0jMT6 X-Received: by 2002:a17:902:ec90:b0:1a6:d774:339a with SMTP id x16-20020a170902ec9000b001a6d774339amr877339plg.4.1681975750645; Thu, 20 Apr 2023 00:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681975750; cv=none; d=google.com; s=arc-20160816; b=igLbB2M+8gOsqV/xag2OKsFwtRnkF6P2RaiLt7QJ8LGSFKA/4WIwVjd8X//w+kGVty tI81cdbiTvvi8ZNjegwLuKO9S7rQlITpQ0KX2msOIpgMl42XCV8kuLKX7jD89yUj8m57 li7rGvGTZS6pWvfcatT+iywP8gNECzWXHJiiXcMV5h/xPvjR2+IO+vze1SgMATxtjNX9 U8GDhb/OFrhmBbwha22ARS6Xj1K4xcPqYQCZ8VlViKrPaboBvENDopd/9SJ47yzWtOt7 a06CVOT7Ms8pnsvUVk42EHoJDBz5Wr+0A1WNAwuMWQ8BokmsE7KDNmBfd49lhz2ImqKl sNSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hg5G5o39i/mOMMBB9sZHDlNqgHJXvtHyvxUr2dJ6THE=; b=HbBEYL7DQfTiGxixSjL9pxNB5+6zwrU9SHBW/eEUZPbs/LQDjJ6qjm7Lp3TKvMNNNQ rorwiFmGLVl23oZ+Pab2Bj+V9Nd5/KSDuKBPz9gnmKVkQ7NuzCvIFOTb/X9dWehM11Hd SfdH201E6mJX7PrFcTVpdWkJn/RTivoO5Ohlg9gXQneTmImM9jeKKwr/OCTre2alZdpf fFlq7E9swrK4EHuEzDM0Oiwe0JQU+uXIWYFpta83kct1HXfZdM953Qs4/7uFmOZPJDEh BTknaJi7IgUxSERzBRTUhjm9fAnIdLIugPBtzGeTs9xle+Mmt96K7w2/AfVT9sDQpM4A lwqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kH4OTVJn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a170903229000b001a81e7b2a88si1080820plh.604.2023.04.20.00.28.56; Thu, 20 Apr 2023 00:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kH4OTVJn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234050AbjDTH17 (ORCPT + 99 others); Thu, 20 Apr 2023 03:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234082AbjDTH15 (ORCPT ); Thu, 20 Apr 2023 03:27:57 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504C135AF for ; Thu, 20 Apr 2023 00:27:11 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1a6bc48aec8so6580905ad.2 for ; Thu, 20 Apr 2023 00:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1681975631; x=1684567631; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hg5G5o39i/mOMMBB9sZHDlNqgHJXvtHyvxUr2dJ6THE=; b=kH4OTVJnseH6q7Pe1OOos6zPSHDAj2tZ3qazT0bYMqWKsaGrGzoVXAs3l/JAw+j1uX BXCMEQb6ZcsuZ3SVhgAScqbhp0DJlBdJO8HBkB0E+llRcaSBO0Os/+DSrtH3J0oUSNcY hae3WB91GwxFXIIvhDunREC36+rEKUAaCp36mnpohuHY1u+KW2U9FzpIXSs5wXp39BQ1 6TA0plyxWwwY0ADUdpTefB6sKA2APq+b1MZxAwbklNl2gWCQUlOtlgz3V7B0Yx4iJNGl pjWTq1UvjsNAsXD66F9eEMQPuhP7xgOsZ6wiF+iSqJrg+wxvZ6hvVOPvUMqmc8gdoqZl ++cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681975631; x=1684567631; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hg5G5o39i/mOMMBB9sZHDlNqgHJXvtHyvxUr2dJ6THE=; b=HgNRpWYIOtYjuGBO7iVUnS5I9SlLTHHQ8Nsxz8u8KsD8EXKJrG2L3G0lE1GqFEDTbi v5dmViH9A+VCs2XoqGoHYzRZN7DnSJ4o71xyllf6WtG+V7EvbIo1rVI9LDN/zYbJN1Oa ScDR/wrZNTknimLxDAUlEtryaMn/o+ZwofiFB17V+BnboRKyLPoGri8YJKrkVjjrh/hq cjeXIR+PrtKlKm2e5xHRGKOngUpz8LimIdlhRFU1yVcd7kwsdL+Vr9qMpIw/9b/pWLlP iMCRF8ZsUA0TxMaqHCWpydLSTq3GHpj49uSZ21ZwCrnHLuAZqXFeTY0WqPXlbGs2mBrM 4mmQ== X-Gm-Message-State: AAQBX9fdGzdk2CQ0uw+OUIiABDP2oQNluwaQoGMlyfe3KUlTbL75RII1 GQ5B/MgJO/gTTQi3cKtgCVWCfg== X-Received: by 2002:a17:903:2444:b0:19e:6cb9:4c8f with SMTP id l4-20020a170903244400b0019e6cb94c8fmr814495pls.41.1681975630719; Thu, 20 Apr 2023 00:27:10 -0700 (PDT) Received: from C02F52LSML85.bytedance.net ([139.177.225.238]) by smtp.gmail.com with ESMTPSA id y18-20020a17090ad71200b0023440af7aafsm612160pju.9.2023.04.20.00.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 00:27:10 -0700 (PDT) From: Feng zhou To: martin.lau@linux.dev, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mykolal@fb.com, shuah@kernel.org Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, yangzhenze@bytedance.com, wangdongdong.6@bytedance.com, zhoufeng.zf@bytedance.com Subject: [PATCH bpf-next 0/2] Introduce a new bpf helper of bpf_task_under_cgroup Date: Thu, 20 Apr 2023 15:26:55 +0800 Message-Id: <20230420072657.80324-1-zhoufeng.zf@bytedance.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Feng Zhou Trace sched related functions, such as enqueue_task_fair, it is necessary to specify a task instead of the current task which within a given cgroup to a map. Feng Zhou (2): bpf: Add bpf_task_under_cgroup helper selftests/bpf: Add testcase for bpf_task_under_cgroup include/uapi/linux/bpf.h | 13 +++++ kernel/bpf/verifier.c | 4 +- kernel/trace/bpf_trace.c | 31 ++++++++++++ tools/include/uapi/linux/bpf.h | 13 +++++ .../bpf/prog_tests/task_under_cgroup.c | 49 +++++++++++++++++++ .../bpf/progs/test_task_under_cgroup.c | 31 ++++++++++++ 6 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c create mode 100644 tools/testing/selftests/bpf/progs/test_task_under_cgroup.c -- 2.20.1