From patchwork Fri Dec 2 17:16:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 13062998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57DD5C47089 for ; Fri, 2 Dec 2022 17:16:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8B546B0073; Fri, 2 Dec 2022 12:16:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D15B06B0074; Fri, 2 Dec 2022 12:16:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B67856B0075; Fri, 2 Dec 2022 12:16:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A3D5F6B0073 for ; Fri, 2 Dec 2022 12:16:20 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6A1381401FB for ; Fri, 2 Dec 2022 17:16:20 +0000 (UTC) X-FDA: 80198019720.12.063E9A3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 298C3160010 for ; Fri, 2 Dec 2022 17:16:19 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GI4jiMDs; spf=pass (imf08.hostedemail.com: domain of bfoster@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670001380; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=yKke9EW2oGA8ByDm6GYJX6e3Hk5NSm64Il6UHZTRwa8=; b=sZcRbwRDzTgjGdflektKAhbSX7DbxlUAxDUnrT6RVfZ1w7UWc1eQCc/AlDbareZBy/P2J0 nRmGf/vAhmoO3NXc/rjtqjvDTaQDvTbBeIWG2CdmN6g7gaXRewG/8Sp5jQ3zR8ERADJbi+ hKJyQ9WkQrAm9wSWRNSjV+lxyXGggpI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GI4jiMDs; spf=pass (imf08.hostedemail.com: domain of bfoster@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670001380; a=rsa-sha256; cv=none; b=LMhiupwY4eg+npAL5c2u1kxfvJ3i1nQMGDBLAjOvlJ+gqTYY22KsBviALromKIk3C15pEj IwshR2x/tBuEPYAm+FT4DVBPKK8S49oVwqyyy9gv6hK4tsIejwHloF9cMJ7qd6kfh1COhc kFSyxJS3Arxqlcp2s7CC3HPLnjnZq7o= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670001379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yKke9EW2oGA8ByDm6GYJX6e3Hk5NSm64Il6UHZTRwa8=; b=GI4jiMDsiKqtnYp56JkWZQKWAibAl/YnZlSH0EUXq4/U22KgRoMAMa0UQfLFgqAsR7Vhg3 EQ/NEP/vEvH1cKahtxkLSKu+0hPagOpzqchfRjqcMFNrfXf0AgQ1saZKcaWxiRgYJk0ml6 eIeP7coww05K5ir+ETG1YjEQ7wPdH3M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-556-vjZ491oLOVi0QDHOSxrY_w-1; Fri, 02 Dec 2022 12:16:15 -0500 X-MC-Unique: vjZ491oLOVi0QDHOSxrY_w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1DBE185A78F; Fri, 2 Dec 2022 17:16:14 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.8.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE2C740C947B; Fri, 2 Dec 2022 17:16:14 +0000 (UTC) From: Brian Foster To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ikent@redhat.com, onestero@redhat.com, willy@infradead.org, ebiederm@redhat.com Subject: [PATCH v3 0/5] proc: improve root readdir latency with many threads Date: Fri, 2 Dec 2022 12:16:15 -0500 Message-Id: <20221202171620.509140-1-bfoster@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Stat-Signature: i5imj9bgmztjrt6janucopb8akmbg3bp X-Rspam-User: X-Spamd-Result: default: False [-0.08 / 9.00]; BAYES_HAM(-2.68)[90.41%]; R_MISSING_CHARSET(2.50)[]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[redhat.com,none]; R_DKIM_ALLOW(-0.20)[redhat.com:s=mimecast20190719]; R_SPF_ALLOW(-0.20)[+ip4:170.10.133.0/24]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[redhat.com:+]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 298C3160010 X-Rspamd-Server: rspam06 X-HE-Tag: 1670001379-774971 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi all, Here's v3 of the /proc readdir optimization patches. See v1 for the full introductary cover letter. Most of the feedback received to this point has been around switching the pid code over to use the xarray api instead of the idr. Matt Wilcox posted most of the code to do that. I cleaned it up a bit and posted a standalone series for that here [1], but didn't receive any feedback. Patches 1-3 of this series are essentially a repost of [1]. Patches 4-5 are otherwise mostly the same as v2 outside of switching over to use the xarray bits instead of the idr/radix-tree. Thoughts, reviews, flames appreciated. Brian [1] https://lore.kernel.org/linux-mm/20220715113349.831370-1-bfoster@redhat.com/ v3: - Drop radix-tree fixups. - Convert pid idr usage to xarray. - Replace tgid radix-tree tag set/lookup to use xarray mark. v2: https://lore.kernel.org/linux-fsdevel/20220711135237.173667-1-bfoster@redhat.com/ - Clean up idr helpers to be more generic. - Use ->idr_base properly. - Lift tgid iteration helper into pid.c to abstract tag logic from users. v1: https://lore.kernel.org/linux-fsdevel/20220614180949.102914-1-bfoster@redhat.com/ Brian Foster (5): pid: replace pidmap_lock with xarray lock pid: split cyclic id allocation cursor from idr pid: switch pid_namespace from idr to xarray pid: mark pids associated with group leader tasks procfs: use efficient tgid pid search on root readdir arch/powerpc/platforms/cell/spufs/sched.c | 2 +- fs/proc/base.c | 17 +-- fs/proc/loadavg.c | 2 +- include/linux/pid.h | 3 +- include/linux/pid_namespace.h | 9 +- include/linux/threads.h | 2 +- init/main.c | 3 +- kernel/fork.c | 2 +- kernel/pid.c | 177 +++++++++++++--------- kernel/pid_namespace.c | 23 ++- 10 files changed, 132 insertions(+), 108 deletions(-)