Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6442316imm; Mon, 27 Aug 2018 16:17:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYwmI3wcmLRLt0RwtxuNYVg5r6TYflrqdOhllvkpif01rksS5wbxHVrgPEi2anPREUki+90 X-Received: by 2002:a17:902:704b:: with SMTP id h11-v6mr14722329plt.116.1535411875284; Mon, 27 Aug 2018 16:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535411875; cv=none; d=google.com; s=arc-20160816; b=K6LaN2gnjFUXLFFcV5Z1uiB6pGk5CKMHWBm+/7wuxynYYWaNfqS3ukSNeIEGczwLpX /D+FutsCaMIS5m+YP88QbLBmEXv/UzX0jnZ7d+LSS7zbJEvos+uapIaDkHQ1WPti1LoB kHtxQhOHMXz6J0XX+4MOzg1SO5gCgnzDgZPW6pxyxSDdfwg2oTGkEfb4AK5KujRa3xsQ z/Dl6QuwiG1j6UA8nosj/5C9dMUko6mmWmrHtMP1YKtfnayF50jwf5wv9H+lqgZ+UYWB EB7wMBDNdfxj6IDRSh5DWtd+g7Qw39DLDFyLm/4wRaCoqNIqObgI2Y8BzfnWOtpkbB29 kG7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=3EDnZlIeAFOJ8WEIsXbF6U8YYDDktTGw02/653a2pOg=; b=fW1wtbtHt34ndu08dHm9VAJ0Jrh1XQnWPRtyunKppr95skDBP8XmSea9hbgboxLWPe B96gigHK7vqEVK9ayLNBaVdTNyMFYjqdy5z5bMaWTe/yEhJfGfaTgnD2X1etapUh1gTU j3LuLoeX/ttWJvWrVW5UPXTa/ASVXwej2t3pexpz9XOQs5BMCLX8O2o/jO2JNTVOt020 k7MpaATeNTvfEJHZd7SiiZMNLyV/injXNNSrfN1vTxn2a2K0YKX6c5JEornQRbZuqLtA 56uX2qrcVVlFobrgKbcKKDrASUP0PNWJkNudS9IgHVNYTL1Zx0seE/v4OIngNGcC0CD/ 4Ohw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=al6F+mnz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si496223plg.340.2018.08.27.16.17.40; Mon, 27 Aug 2018 16:17:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=al6F+mnz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727622AbeH1DE1 (ORCPT + 99 others); Mon, 27 Aug 2018 23:04:27 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:46714 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbeH1DE0 (ORCPT ); Mon, 27 Aug 2018 23:04:26 -0400 Received: by mail-ed1-f67.google.com with SMTP id k14-v6so421377edr.13 for ; Mon, 27 Aug 2018 16:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3EDnZlIeAFOJ8WEIsXbF6U8YYDDktTGw02/653a2pOg=; b=al6F+mnzWoZRjPPKKGXpJ8Gm3TXD/W65I2nh2b++L1qyIGeQNYeWQ6l13xMQRvFpOP NfY2aQ2PxTEwapzgH2yBPvmGPw2SnnngrhmNtO6K7Sa0ACV8ODPKPniSNAI6qUx9fPiw G43SEO5E6WmMonKzGsakU5PwbmM2b256lNbKBu7fQSlMWGAyaJLn9O1U5LsYnK3fGJtv qZ8ud+vb8MrJ3YuVi8OW8mMRZbB0smuyMOn5eSDA549hGP+EMhkhpLLgHu/hePUS6HkB Oeion7JjwR6HPnOBdhZSyMfcDoptdM8+c4AOHVp5n1vRCotqGm57RQ8VZevXjg/TX2Jy 1WPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3EDnZlIeAFOJ8WEIsXbF6U8YYDDktTGw02/653a2pOg=; b=fVYeb1HMX+qnUl36wfvydAqVVWAMWovibwGYwl/JJ9eMMxnKL+sxz3Ksifwm+OSs9N rSM0Ya2cIBppyMglc0La8eiSnEA4IzkihuDMmdTUOOq9nSCzhePTu1iZLzqRfgchcfv3 eovezO3ab9WZ9VEJztHW84BiAMxn9g2ldO8ucUgf8Fvz5ZXvk7Y4Ysmw9poQIaRM3YI3 /wt24lTq+Lw5x6OYndv/WB57GyAau4JBtg1pqwDdqqdRBRxa2/pnBosZ9T+w1pXOmgNY OckRtioWIxxtkZdcWpkB82AM7ubghMMgmsQKufAB6hpBB9IAGG+SJShbeQvv2ctSPVAv SRwQ== X-Gm-Message-State: APzg51D9LkAaO0EWK6Y0778XCeYfkfbyL4TPuEnVrT2TlTZMpvI+qDBR 8xEUFmHfKtp9KLXdCnHoMQ== X-Received: by 2002:a50:a402:: with SMTP id u2-v6mr18564439edb.237.1535411740048; Mon, 27 Aug 2018 16:15:40 -0700 (PDT) Received: from localhost.localdomain (nat4-minsk-pool-46-53-177-92.telecom.by. [46.53.177.92]) by smtp.gmail.com with ESMTPSA id u3-v6sm173918edo.44.2018.08.27.16.15.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 16:15:39 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan Subject: [PATCH 09/13] proc: convert dentry flushing on exit to _print_integer() Date: Tue, 28 Aug 2018 02:14:59 +0300 Message-Id: <20180827231503.26899-9-adobriyan@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180827231503.26899-1-adobriyan@gmail.com> References: <20180827231503.26899-1-adobriyan@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Benchmark fork+exit+waitpid 2^16 times: 6.579161299 seconds time elapsed ( +- 0.24% ) 6.482729157 seconds time elapsed ( +- 0.42% ) -1.5% Dentry flushing is very small part of exit(2), effects should be more visible on a tiny 1-page process which doesn't uses libc. Signed-off-by: Alexey Dobriyan --- fs/proc/base.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 17666bd61ac8..79d2f7d72ad1 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3022,11 +3022,11 @@ static const struct inode_operations proc_tgid_base_inode_operations = { static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) { struct dentry *dentry, *leader, *dir; - char buf[10 + 1]; + char buf[10]; struct qstr name; - name.name = buf; - name.len = snprintf(buf, sizeof(buf), "%u", pid); + name.name = _print_integer_u32(buf + sizeof(buf), pid); + name.len = buf + sizeof(buf) - (char *)name.name; /* no ->d_hash() rejects on procfs */ dentry = d_hash_and_lookup(mnt->mnt_root, &name); if (dentry) { @@ -3037,8 +3037,8 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) if (pid == tgid) return; - name.name = buf; - name.len = snprintf(buf, sizeof(buf), "%u", tgid); + name.name = _print_integer_u32(buf + sizeof(buf), tgid); + name.len = buf + sizeof(buf) - (char *)name.name; leader = d_hash_and_lookup(mnt->mnt_root, &name); if (!leader) goto out; @@ -3049,8 +3049,8 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) if (!dir) goto out_put_leader; - name.name = buf; - name.len = snprintf(buf, sizeof(buf), "%u", pid); + name.name = _print_integer_u32(buf + sizeof(buf), pid); + name.len = buf + sizeof(buf) - (char *)name.name; dentry = d_hash_and_lookup(dir, &name); if (dentry) { d_invalidate(dentry); -- 2.16.4