Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6441884imm; Mon, 27 Aug 2018 16:17:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbPoG73mSmEjD4ht93i6y+SOWlOIdQ4otOw9+iSsMbAnvbGt/JUaQyB3p8KQN3w0wxxdGdc X-Received: by 2002:a63:dc53:: with SMTP id f19-v6mr13950511pgj.56.1535411835948; Mon, 27 Aug 2018 16:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535411835; cv=none; d=google.com; s=arc-20160816; b=oByHLmg5hS6BEm8YDN3kwmfQdiK1RTtP04HqXhzMdwEXKLSWJ1jjhfrFk9hGLD+334 QsdNgtpL8WO7EP0SzrJ7GfCiruM71nA8Hz6I6fNylsZuoNOoaXq/pSj7iWI94X2tGK4x BROdQKZPZLCTUtODBW6zKJ25sgL0V+fK7qeJivTUTclU8V8i5lJOTSJJlzRRHTJcTm1R MXJlGr99I1Pken9cgStJ56PK/f1vN/FgLCmYeAEu71/X/0V9Eb/O9Z6Ab7a0qqajgunf u6HPgyprVL8GfwfpGTKg7KVFMGFSnNK0twDGNXeMTn41hbkru4URocnlDU9PtnprD6ec QX1w== 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=Z4wY5SxtbqayXTNKr6tydWliEBo2ImNu84K0iwTVEJ0=; b=s2WqESl2zqmlgVycLnJ0xL22uvju97qFtrKFvycMy5DNTuzBBmGohqN/6OexO1PKNi IcIvBh3HOXEpDwdJ6tVWQs68tPnTPNn4ZpfcYBalQYyNYTdxb0AKrAIFnuULg3C5MfL1 Xas1jqLchwQ9BEcMwdeZUWIdMZDU9GjmO3/pPgLXAtxZvUicLxTcHMoRWEZQNjSMJgz0 wKSMR09IyEK3FFTpITNIcg7pYJ1oBZyHUNQ/Hj/C8zupiHm8Su0g2SfArfvmnMQbQkh8 mhosRcsFLqi5MBTHskuxC3yw/kJMmbOydsnH55y51HTRB91PGGvd9c9/nLfinVGfRfQw kEaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bDbkmhRM; 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 a6-v6si499987pgc.659.2018.08.27.16.17.00; Mon, 27 Aug 2018 16:17:15 -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=bDbkmhRM; 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 S1727714AbeH1DEb (ORCPT + 99 others); Mon, 27 Aug 2018 23:04:31 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40248 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727660AbeH1DEa (ORCPT ); Mon, 27 Aug 2018 23:04:30 -0400 Received: by mail-ed1-f65.google.com with SMTP id e19-v6so444335edq.7 for ; Mon, 27 Aug 2018 16:15:44 -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=Z4wY5SxtbqayXTNKr6tydWliEBo2ImNu84K0iwTVEJ0=; b=bDbkmhRMDJdTfb0iSLX09SNXUQbyQDYWbT2xTDanb/ZG7FkQvP6yBRpOZE5/JS633E BoDcLNHNaO57jdCWrZ+xzKTnGBSsbYcV2i3DkWMPJ1+17xSVi6TAGnUobjOsy0fhusKU L8JmZ1lMeH5p/yQ/eAUnkV/6YSUw0V8n8yjpvmduJ7ReQ31aOuE03iHNuNm/9rVPnk5d NZtMs4ifI9O8rD1k8FgopT4x+SExI5g4GtkKj0hlg1p/VjyTNvO2GiTXebwPRclh/S3X WpNwEn0yDUl8ZEDok5jTTfpu1DIWruLHIiI2QDj8PmxJ8IAUhspBfQ8t/O4Uuw+llfpz fGkw== 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=Z4wY5SxtbqayXTNKr6tydWliEBo2ImNu84K0iwTVEJ0=; b=HkfgmHfX/lt8Sz3+WW6cwqtfACJAwXTL8sDle9CVw7wVed5pIZ5xqVoqCAU4rR/gx1 ZKBrQN2pXSF/F8gBQjfyVEK9g/QXpyIS9+TEvOZJzNzjMgHeuaC31d+NCjcHI6CMCVnV owVxVpZ/rQioDAFNTj84BmH4cObigp4lZyscJiKjMuvkZ8Ij6Mh0sYJvUAGSXfRRO8dD /tmUaHDQeWTza9LVqRb4GxXKNfiGWjAJdWr9kSN4faZO/gVnaMHGFDcSIcCnY1DlHyXc VlhbNDPRdh0An2sEmtrl+91dOTsBeac0WhKZYoo06yZRCHnPpx9mtgytkLGCcwSpFj4O uRMw== X-Gm-Message-State: APzg51CiflRY4xu5rWYDkJAcTXr8Zc869we32JKslyff40Ixt4i1NNlw 9MsWeKkC2fAa1HrHPmKmfJkuc0Q= X-Received: by 2002:a50:9034:: with SMTP id b49-v6mr19704662eda.174.1535411743588; Mon, 27 Aug 2018 16:15:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 16:15:43 -0700 (PDT) From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Alexey Dobriyan Subject: [PATCH 13/13] proc: convert /proc/*/task/*/children to _print_integer() Date: Tue, 28 Aug 2018 02:15:03 +0300 Message-Id: <20180827231503.26899-13-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 pread /proc/1/task/1/children 2^21 times on the same system: 6.766400479 s 4.328648442 -36% (need to remeasure on a controlled set of children) Signed-off-by: Alexey Dobriyan --- fs/proc/array.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index d0565527166a..045ce2cac1dd 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -710,9 +710,11 @@ get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos) static int children_seq_show(struct seq_file *seq, void *v) { struct inode *inode = file_inode(seq->file); + char buf[10 + 1], *p = buf + sizeof(buf); - seq_printf(seq, "%d ", pid_nr_ns(v, proc_pid_ns(inode))); - return 0; + *--p = ' '; + p = _print_integer_u32(p, pid_nr_ns(v, proc_pid_ns(inode))); + return seq_write(seq, p, buf + sizeof(buf) - p); } static void *children_seq_start(struct seq_file *seq, loff_t *pos) -- 2.16.4