From owner-svn-src-all@freebsd.org Sun Nov 12 03:36:23 2017 Return-Path: Delivered-To: svn-src-all@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 0D465E6726B; Sun, 12 Nov 2017 03:36:23 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (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 BA5037A7D1; Sun, 12 Nov 2017 03:36:22 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x243.google.com with SMTP id u43so485257qtb.2; Sat, 11 Nov 2017 19:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UI59GyobMzsH8foYfCgF6m631Q5hQMlC6nN9h/T94W4=; b=qKhbELq+uoLtDIZynBhr83lqfQMMpm2AQ0AJHPeaqnhi1Jzz0PyjnRRJdfXViorCey rH6cutDO8iYwMEnT8LDEFwLLKSl4Fv/T7X6i9HxkyFcpDVioh2tpO1TcLAv+7QjxclCk +PTXmUBLUkb1zNac9mgRKhlIPf2Mk8h736suOn2sKtujjAtEYm5apIP9mT5cMQ9x1waZ nB2ybUGQZYeqRTvlMx1EKUmQSB8wFEmhsKTb8vbbWDbVwyqBztmoaCDdhF5c+hnYOvQ2 I8WLULrqwxQn3GFGLU0clU+nAYNHFWaJxxeL7LavNzB3fnPhQaoltSIuP9yrioE2ilHk 88JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UI59GyobMzsH8foYfCgF6m631Q5hQMlC6nN9h/T94W4=; b=O2sPXLm/NVfGXf4s2lJQJT9WB87ogQYMqHDg2e24fC7Sfe6BZXC88QVDyFGwIvXyUj dePY27C9gG5fBv3afb7Xx0waUALvKq7kETzcDOGxRCEaRj4Ke3a2zYPpfZdUQTmRIBxs a0IinL/cCgAKBMllUU1ZjoYYAEoHOfZdciJspp5C20atSKj6bigUwBPi3l47dL4ZIn4N 5YVdTO6IFeYZ4X//aUET2f7Cc4k5qC8yizlzRssecPfC6DDFzX4KF3WnpnZJB6/ejBJh XNJ7zGFmbwI4W4CnE+q/MHvVZFIYBKEEMR+5mMsZpeGhOxeP0MVewq4VjmPrSehNp/0R 5p7w== X-Gm-Message-State: AJaThX54r69W9WfCPkMHK6MmJhuEaq71q3kGtkN/KswbOlK3PJUbSl0L uIGOjs1O3QX8HklKn9nn+1vrmmkfSUiOyGT4ITs= X-Google-Smtp-Source: AGs4zMZjhs2G0U0WqVk9k/7/hqpZo5hwrjlF/jOBAeuV98JuWL+sEh7qdWGmCNVWGTIByqQfgrcsoWEwbw/AX2g5dRo= X-Received: by 10.237.33.186 with SMTP id l55mr8488765qtc.71.1510457781915; Sat, 11 Nov 2017 19:36:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.52.198 with HTTP; Sat, 11 Nov 2017 19:36:21 -0800 (PST) In-Reply-To: <20171112043244.GA1266@bish> References: <201711111804.vABI4e6H038060@repo.freebsd.org> <20171112043244.GA1266@bish> From: Mateusz Guzik Date: Sun, 12 Nov 2017 04:36:21 +0100 Message-ID: Subject: Re: svn commit: r325721 - in head/sys: kern sys To: Mark Johnston Cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Nov 2017 03:36:23 -0000 On Sun, Nov 12, 2017 at 5:32 AM, Mark Johnston wrote: > 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. > > > > +/* > > + * 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)? > It can, but at the expense of avoidable branch-fest. pget is rarely called in comparison anyway. -- Mateusz Guzik