From owner-svn-src-head@freebsd.org Sun Nov 12 03:32:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8F32E6715D; Sun, 12 Nov 2017 03:32:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5FA07A631; Sun, 12 Nov 2017 03:32:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pf0-x230.google.com with SMTP id b79so9483328pfk.5; Sat, 11 Nov 2017 19:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dClzf8riQOQgFYJDcTW3N1P2hv1XuotCV9bxNg7rBBU=; b=L+KGRNAkT1AL39tXZ7Wz17usolFXPkuUwhTdYGhLgYS7acQgTXr5i6zBMAY7FLA7Vs ACiE1TSEcZwmlVonasdnYz4UJsM6NTXmT6Aa2rf6HsG9adbWeuqkOtc5zI8nTOFTIciC vmuBKn7X6em59Iwwg2NOAa+4hA//Q4ErkmaiGKKbB6V1NQrFn28lq4Cb0Gk08vxuhKLN /LlfBNO8HyXcsZALfzznp27Ms3c8w/SM/VHHPw7GuaDd8G3g/tBt4pLF2DjfiBgITHnb EtZT4DBv/eIJ/aY4vBEB/wjVbGgzqUaS5eOffFxoQ7fLGGb9nh6DAJ9cr72uRj2nRajS bbGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=dClzf8riQOQgFYJDcTW3N1P2hv1XuotCV9bxNg7rBBU=; b=op2JNMgduh7cSseq0NnQ6izz61p0r8aLfH3N1DCuFyZgQ+I1bPb0yuXS4RlVZgUVkT JW4mo739xGXYxIcSJHefq3T+rUWaDpgCsP5cWZZ/zM8AiYzar3oYC4W3biLgSWdJ7Pqa iJr96gPPbdBAzfVqwhwr3cYWLpOjtm8QFFL6ohwOU2/9a+QQMuPVCG8SOjlxcojIqRMp Pq19YvZMK7kHAcVHnuEFgTkd0QDRIW5gNY3Tf4E7Lzq1jLe6tg0T64en3401gUnDgBYw 4H/SpAc1CCvCMuFDsr8ICgm3pdi1nCFhzisLa8s3pGLCTonoV7eBzh9sjpRJ0tJ+IkOR JAng== X-Gm-Message-State: AJaThX6r0EZvGssXLc+mZdKd49gwcMwXFk5OGqMcG2vs6pDnA+4ogmH1 5SO6QVP81KOCAkb63nx0M68eJQ== X-Google-Smtp-Source: AGs4zMYfAnHrnOKaR4XE/w9RQ4FypQ2GwUXsvunVrKTkrbuotEQsNQh1rnXJz5nbN6Mx304uZdcC2A== X-Received: by 10.84.210.237 with SMTP id a100mr5021818pli.177.1510457567726; Sat, 11 Nov 2017 19:32:47 -0800 (PST) Received: from bish (59-125-183-239.HINET-IP.hinet.net. [59.125.183.239]) by smtp.gmail.com with ESMTPSA id b16sm26239266pfe.58.2017.11.11.19.32.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Nov 2017 19:32:46 -0800 (PST) Sender: Mark Johnston Date: Sat, 11 Nov 2017 23:32:44 -0500 From: Mark Johnston To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r325721 - in head/sys: kern sys Message-ID: <20171112043244.GA1266@bish> References: <201711111804.vABI4e6H038060@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201711111804.vABI4e6H038060@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Nov 2017 03:32:49 -0000 On Sat, Nov 11, 2017 at 06:04:40PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Sat Nov 11 18:04:39 2017 > New Revision: 325721 > URL: https://svnweb.freebsd.org/changeset/base/325721 > > Log: > Add pfind_any > > It looks for both regular and zombie processes. This avoids allproc relocking > previously seen with pfind -> zpfind calls. > > Modified: > head/sys/kern/kern_event.c > head/sys/kern/kern_proc.c > head/sys/kern/kern_sig.c > head/sys/sys/proc.h > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Sat Nov 11 18:03:26 2017 (r325720) > +++ head/sys/kern/kern_proc.c Sat Nov 11 18:04:39 2017 (r325721) > @@ -353,6 +353,23 @@ pfind(pid_t pid) > return (p); > } > > +/* > + * Same as pfind but allow zombies. > + */ > +struct proc * > +pfind_any(pid_t pid) > +{ > + struct proc *p; > + > + sx_slock(&allproc_lock); > + p = pfind_locked(pid); > + if (p == NULL) > + p = zpfind_locked(pid); > + sx_sunlock(&allproc_lock); > + > + return (p); > +} Can't this be written as pget(pid, 0, &p)?