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 X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9351EC4361B for ; Fri, 18 Dec 2020 21:03:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5810023B7B for ; Fri, 18 Dec 2020 21:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725911AbgLRVDB (ORCPT ); Fri, 18 Dec 2020 16:03:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbgLRVDB (ORCPT ); Fri, 18 Dec 2020 16:03:01 -0500 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68E9EC0617A7; Fri, 18 Dec 2020 13:02:21 -0800 (PST) Received: by mail-yb1-xb2d.google.com with SMTP id d37so3137098ybi.4; Fri, 18 Dec 2020 13:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=47vveCYCVpthvHmKjVidfRBrMv4CgoZqAi5d0tl2Cos=; b=XtCtwzQ+h11D7UFAoi3ICRNh21XpjfVsLQhKHtKE5iuXoN8prq/7NPSPTzzTdC9V2u IF3lr0G0JRSG7rNYtON4nkoI5y6w3SjUoVKOof5Q4YCFi7V+I0Dt2LRs/Ynu2Zf2StNj ld9qC/LFcH5ToZBjA1MRu62ggju5ufdz8PHdbpdYY/usbYdYao9FJVIkhpARsRDejEIu 0T2E2QOXxoxS+c7x317TNe0ZYdCe78xfLjCI7leJOal3oKChOYPHXt1p86WUVh2tihvj s4UK6FB7vdBFGJvxzXdY42xoDfUCDZF4QK31/x/W05ZMG5pi7S0swq5clNJOCsQUUoGY k4Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=47vveCYCVpthvHmKjVidfRBrMv4CgoZqAi5d0tl2Cos=; b=OqaQEWP8sin07vAHbqv2PQHHrTmesKhtnofTgl2mYF6gH2HDyVJDXR0DxTXaH3Fbi1 2YjzCQkV9kVaY4SVvyOLsQHXTI4bWG1vMAtsvKPSbasy+oTulL9zonpsqd9t4OhoedXf hUB+NA45xPnPiDGk6dPBF9fm1yYu/ohfvsFnGbCjyBzvoyGFsZASATvq5UYTMXth60+0 FRovz9SAm0S2fDiL3DHQBrFduJ52L0bJ+5V0s6ZXm1f8+1FTBwP19K+Hdr2CHkecX12M n85vIzavKefPYjL3cHpd0HS0ayIV+o0saTaMc0iIaIZl1pKOuhp63RFa5T5D1rqBxlv8 R3bg== X-Gm-Message-State: AOAM532ryyLmWVY9QHiylQ7gdgijIs82T2GeKFWBappkHBKC/429qRFP v/FBYBXVtT4YRq6bQ5KqJ/89WjFsUZci5WXsMgiiGNhdzS9bXQ== X-Google-Smtp-Source: ABdhPJzBgMlm072gAVrdjohI/+hpToRVyiTWOyroNg6+1ZV3zwU96R+xEYyces14KuflWU2B6dalESZ2SFukyhV7RZo= X-Received: by 2002:a25:c089:: with SMTP id c131mr8115190ybf.510.1608325340765; Fri, 18 Dec 2020 13:02:20 -0800 (PST) MIME-Version: 1.0 References: <20201218185032.2464558-1-jonathan.lemon@gmail.com> <20201218185032.2464558-3-jonathan.lemon@gmail.com> In-Reply-To: <20201218185032.2464558-3-jonathan.lemon@gmail.com> From: Andrii Nakryiko Date: Fri, 18 Dec 2020 13:02:09 -0800 Message-ID: Subject: Re: [PATCH 2/3 v4 bpf-next] bpf: Use thread_group_leader() To: Jonathan Lemon Cc: Networking , Alexei Starovoitov , Daniel Borkmann , Yonghong Song , bpf , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, Dec 18, 2020 at 12:47 PM Jonathan Lemon wrote: > > From: Jonathan Lemon > > Instead of directly comparing task->tgid and task->pid, use the > thread_group_leader() helper. This helps with readability, and > there should be no functional change. > > Signed-off-by: Jonathan Lemon > --- Acked-by: Andrii Nakryiko > kernel/bpf/task_iter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c > index 8033ab19138a..dc4007f1843b 100644 > --- a/kernel/bpf/task_iter.c > +++ b/kernel/bpf/task_iter.c > @@ -37,7 +37,7 @@ static struct task_struct *task_seq_get_next(struct pid_namespace *ns, > if (!task) { > ++*tid; > goto retry; > - } else if (skip_if_dup_files && task->tgid != task->pid && > + } else if (skip_if_dup_files && !thread_group_leader(task) && > task->files == task->group_leader->files) { > put_task_struct(task); > task = NULL; > -- > 2.24.1 >