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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham 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 25E95C43219 for ; Mon, 29 Apr 2019 14:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2F6A2084B for ; Mon, 29 Apr 2019 14:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728253AbfD2O0F (ORCPT ); Mon, 29 Apr 2019 10:26:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23907 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728254AbfD2O0E (ORCPT ); Mon, 29 Apr 2019 10:26:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62C5B3199389; Mon, 29 Apr 2019 14:26:03 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id 385555C205; Mon, 29 Apr 2019 14:25:57 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 29 Apr 2019 16:26:02 +0200 (CEST) Date: Mon, 29 Apr 2019 16:25:55 +0200 From: Oleg Nesterov To: Joel Fernandes Cc: Christian Brauner , linux-kernel@vger.kernel.org, luto@amacapital.net, rostedt@goodmis.org, dancol@google.com, sspatil@google.com, jannh@google.com, surenb@google.com, timmurray@google.com, Jonathan Kowalski , torvalds@linux-foundation.org, kernel-team@android.com, Andrew Morton , Arnd Bergmann , "Eric W. Biederman" , Greg Kroah-Hartman , Ingo Molnar , Jann Horn , linux-kselftest@vger.kernel.org, Michal Hocko , "Peter Zijlstra (Intel)" , Serge Hallyn , Shuah Khan , Stephen Rothwell , Thomas Gleixner , Tycho Andersen , viro@zeniv.linux.org.uk, linux-api@vger.kernel.org Subject: Re: [PATCH v1 1/2] Add polling support to pidfd Message-ID: <20190429142555.GB17715@redhat.com> References: <20190425190010.46489-1-joel@joelfernandes.org> <20190425222359.sqhboc4x4daznr6r@brauner.io> <20190428162405.GA6757@redhat.com> <20190429140245.GB233442@google.com> <20190429140743.GB173743@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190429140743.GB173743@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 29 Apr 2019 14:26:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/29, Joel Fernandes wrote: > > On Mon, Apr 29, 2019 at 10:02:45AM -0400, Joel Fernandes wrote: > > On Sun, Apr 28, 2019 at 06:24:06PM +0200, Oleg Nesterov wrote: > [snip] > > > > > +{ > > > > > + struct pid *pid; > > > > > + > > > > > + lockdep_assert_held(&tasklist_lock); > > > > > + > > > > > + pid = get_task_pid(task, PIDTYPE_PID); > > > > > + wake_up_all(&pid->wait_pidfd); > > > > > + put_pid(pid); > > > > > > Why get/put? > > > > Yes, pid_task() should do it. Will update it. Thanks! > > I spoke too soon. We need the task's pid of type PIDTYPE_PID. How else can we > get it? This does an atomic_inc on the pid->count, so we need to put_pid() > after we are done with it. Did I miss something? Just use task_pid(task); Oleg.