Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1965205rwr; Fri, 21 Apr 2023 02:07:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZiJCDyKQR0OCxmClP3/fpbSZsUnL1qAlJL07K7v20im66oQhZvnoIvyohYVawRjq4Wrend X-Received: by 2002:a17:90b:d8f:b0:246:ee1d:b4d6 with SMTP id bg15-20020a17090b0d8f00b00246ee1db4d6mr4605552pjb.41.1682068073631; Fri, 21 Apr 2023 02:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682068073; cv=none; d=google.com; s=arc-20160816; b=kFYjmIlwkBwstwENI/ylpMSXe0JAF4lYfOh+dwm9uZ395m4/wGqjLse29CvFVasjQM cXTM9oJQYhiIguiLq6BmucZmkNCvZr942oDgL1y/7rFByY7FlfmbCsU3kvln8gcZ2zwB RrxEY8KHCDq10WDcZzXnRun3MqIeY4S2p0pUxBC5K2zauZh2GXMJapCqn1O6VljyWEaM LaqlIzivUhA6OWBmnKnKd04Tiph7tYcwqAP3xdZdwAoBmjCEUJ5pv9WWgJqQIzodLcmG wv2s2xwhiEATMGjEXbm/tXOQkumIeKPOlwZrpRAj4i8ykoRZ6CLTktvbdh1/yEs4mxb5 Pefw== 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=akWWD6Hh6r+OYGyfrxLzmZDpacDQxQ27SVpN4XMCC9Q=; b=nhpdiw0gLQ7bjFSnZ0WzH+IBn0sfGQIDdlTGcokaKCHZzFf5DjKYJTKY55SsfdPW8f Ld4ybKwymhRuQSq9LsT4jYdSG2kwV6goJC79vu2h0B9oGdQg8qO56X97ywxDoH0Ojz54 UouQ6wQb14P/x02mD/oky0fS10sJ69ZTjgXrhGCSOzdscSQk/WyNrT9UrEb3kJ4TGxzj 5ccQIRSOUVbiTEkylZUD0GaiHUZRuXMDVxkecKDHsDAU7MM5stnCZculCeqMwD9qFM6N pTTQQLQfnXCKi7wOgSanxpW34NQFUk2CCX89waE/TSD+G/R8z1NdJhDR/JW7PeYJGOcf mpLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=hn6iQuC0; 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 187-20020a6304c4000000b0051f8817a307si3782000pge.869.2023.04.21.02.07.41; Fri, 21 Apr 2023 02:07:53 -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=hn6iQuC0; 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 S231509AbjDUJF7 (ORCPT + 99 others); Fri, 21 Apr 2023 05:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbjDUJF5 (ORCPT ); Fri, 21 Apr 2023 05:05:57 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 998E8869F for ; Fri, 21 Apr 2023 02:05:31 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-63b4bf2d74aso1687243b3a.2 for ; Fri, 21 Apr 2023 02:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1682067931; x=1684659931; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=akWWD6Hh6r+OYGyfrxLzmZDpacDQxQ27SVpN4XMCC9Q=; b=hn6iQuC0rkz7WgMmaMAcsLAAvZra6ZxsIgMlDFed2YP1xoOH+yjOoPqvctYof5NHaJ XoIqnD43aHZQY4jh2CXmBrxnN11oGVwBsmXcZ3cFjr7TS2sbhS9LLnLPM/JQNwGhMRLW 3TjdAUPNHlbDqbaVWRHTJOqCAHK5avxkQwCq84VKMAImyj6vDC3z2qh0cFHBnCIKsZoM A1waAFM5XeQRZE8ZjQc6pYn5H+wGEwkIj+s9WK028cf7sIAxCPXjUShJcOHf40+SXEaw e3KTrDQt7FFfLtBBLBUBEpHItHSHqM1p+8O6VfuWGwnMv35la7XtObm5aU4eLvZ1nv5Y VrqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682067931; x=1684659931; 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=akWWD6Hh6r+OYGyfrxLzmZDpacDQxQ27SVpN4XMCC9Q=; b=Urecjk/B6LsnCpbMF6h3/zz1S4KqFagZNIHIRT35dghWiZNk/JMsawLGoqwokHuR4W iwxFlu4p39CLjeliwK0zYicTfaWuSUVGRIhoKEiRQE6vNZj/OcRiz0EmlkpTKo0VllsT HWHrQ/oxxQnCKyQFWld2l8LtpFhd7zknI5LtXIM4hyn4lvIQo+70DcFOJHROAyHS35z9 fHkVDFWzoCsaQABm+hIzlrfrKflGU398eHNHcQoaSz3bjrz8iWYc2f56e0gDLSwE07cX 5eheInrBAURMjbZuKk1hoHZsBZhJzQVaoiPVa8rLdXSLXIIgx77fGNiLqjChjO0aXLPG CN9Q== X-Gm-Message-State: AAQBX9dc2icW7oBjPkK+7c8Kt5NmdEcpIsp1az8NapbVNj1xXDGpKalB jHJ05gemfDDQQaUfcWWPLc9Hsw== X-Received: by 2002:a05:6a20:12ca:b0:f0:4dbf:5f9f with SMTP id v10-20020a056a2012ca00b000f04dbf5f9fmr6785242pzg.29.1682067931044; Fri, 21 Apr 2023 02:05:31 -0700 (PDT) Received: from C02F52LSML85.bytedance.net ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id t3-20020a17090a950300b0024796ddd19bsm4192309pjo.7.2023.04.21.02.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 02:05:30 -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 v2 0/2] Introduce a new kfunc of bpf_task_under_cgroup Date: Fri, 21 Apr 2023 17:04:01 +0800 Message-Id: <20230421090403.15515-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,URIBL_BLOCKED autolearn=unavailable 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. Feng Zhou (2): bpf: Add bpf_task_under_cgroup() kfunc selftests/bpf: Add testcase for bpf_task_under_cgroup Changelog: v1->v2: Addressed comments from Alexei Starovoitov - Add kfunc instead. Details in here: https://lore.kernel.org/all/20230420072657.80324-1-zhoufeng.zf@bytedance.com/ kernel/bpf/helpers.c | 19 ++++++++ .../bpf/prog_tests/task_under_cgroup.c | 46 +++++++++++++++++++ .../selftests/bpf/progs/cgrp_kfunc_common.h | 1 + .../bpf/progs/test_task_under_cgroup.c | 40 ++++++++++++++++ 4 files changed, 106 insertions(+) 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