Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp613751imm; Wed, 23 May 2018 02:38:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpGDh4+ASUhpu6nyHFlppNEoN1RFSSv9AiW1JV96QUd8+4bPGxXMOIBtLksWXwCOy/bt/pt X-Received: by 2002:a17:902:8f8b:: with SMTP id z11-v6mr2178106plo.203.1527068322512; Wed, 23 May 2018 02:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527068322; cv=none; d=google.com; s=arc-20160816; b=YxEaQIQg/cgEsEU2dE9uF9iytOZZxInhmKrfp+Lc0xk+QZ9+5yznicGgQ6oQ80scnw FKIZ25p+WxBCHM+IIxK4fXeeamXD7yHWIbwXeGyd4FhHegwiQCJTat3kylc2/bULbFXP BhsFqQIj1oqwmi/kjuTWZ4HSONty1rlfHdQA1pfyiX6D256uJNE+U1FKAJC2bC0qEUnt uLQiLgAyeJWbEAHL4yATxQSvdgKx16EEdPVioiLFL7FNSJC1Y/OmdSzO1kPf11D1iuqr cYUv8+pk+uET0I2OkH/+WT7dV4HRq1i1HR4zeqmvcisk+oTV2rE8LEUKP79wvrc4Y+s9 wSiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=Q6wpQ+PF9WWV540WG0WNb4NoMOAi7J4QtYEfrUmjGzA=; b=gde9g2J8maQc+D+UJO46nB7ShJbLSn+g+Fm+qWuW8Xyj7HaugJwDazeD/0Z4XxkALw Eb/fN06AC/0BIkdmlX2os/bVVOrcm7dTi5j+bb31UquBMfjrCDrWGUyXFPltWzdi+BcJ xpNsrT7ADBE5+SN8GCsP1LXQeGJtqKTfQnZ7yJzxfXBajygrN5g7SYSnQMSq4ZVSfA7n EF1EI0eEtKoMq6Vd6vhz4ZQ7W/2nkEH8Gizdnh49nXWwYkocu+do/SSSfm6e+LLk80O/ DZmHZh31xkMjdlqcpZl2UUUspF/jUzFUoeIluMIDToL0HKAZNpX/TIvhhfflNUcT1BDf 1xnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H3RYwSMS; 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 f8-v6si14936020pgr.139.2018.05.23.02.38.27; Wed, 23 May 2018 02:38:42 -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=H3RYwSMS; 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 S932220AbeEWJhO (ORCPT + 99 others); Wed, 23 May 2018 05:37:14 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41500 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754411AbeEWJhK (ORCPT ); Wed, 23 May 2018 05:37:10 -0400 Received: by mail-pl0-f65.google.com with SMTP id az12-v6so12680953plb.8 for ; Wed, 23 May 2018 02:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q6wpQ+PF9WWV540WG0WNb4NoMOAi7J4QtYEfrUmjGzA=; b=H3RYwSMSWKM+hSqdXTIlSX9CkisTABv0S84dhPZYoANY6TAqLjaX9MubH21+QrMNDv 6wCPEmbB1l5R9qx12BA88MS77X+GXnfAG5K3k/2M/kFNZ5I8Q/oNRQf+RbUqQOYaEOG5 0KH8XKIvHsdgzJJXtcoibYPVOX5dhGpEw9xuRuSp2N4+ZH9lpam5mqzjRwJSweSlPQ/B Q9i/KHI6M7VWdAyBx/pfaQWWo4CPRsP39Xn9ew+h74fYNZv0kahdJZiTc+pudnU79aQk 87FqVfbeuBC838Uoy1OfeBXEB3iJPStqgtRwas5o0YOyswIkMFrqSjOtBjqIj/IbfIMW aoCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q6wpQ+PF9WWV540WG0WNb4NoMOAi7J4QtYEfrUmjGzA=; b=pwYFDfFh97pRRYToIy3agssxF8+8wz6asJFWSUve9ZV1pa87h+K0Wq/V6zqRFZ17So uYeCYIR+bGmKBh7tfdx5IBCf30J/FHOBqAcvh8M/EoBqLXuWzWCRXRXn1dVCbEeqDHAW oYfzklQ86Fo2YN0+xNeitNMzY0f5BW5CknwjXQ1Br8al8B7BhNP4bk1tGli7hssAyi25 lYG/Ff6XQNi13i242knqw3cNib+/z0RbW9DvLUcCeRrxlOfs9wV27rBOjENp4zF93aaM oVYdGrUlPR6tV3iakKlHbl45aqKYCUD0/MWJ/ynbxa430G+fSzCvd0D9NAOxBEf2CWz+ W42g== X-Gm-Message-State: ALKqPwcYbZf6i0RjMPKX8lzOS9KagPdjoR70DNSNfO8VRxwMwPtiFoEM kYLZlzyhaVg9tJ5VjimJetA= X-Received: by 2002:a17:902:9004:: with SMTP id a4-v6mr2182056plp.143.1527068230019; Wed, 23 May 2018 02:37:10 -0700 (PDT) Received: from roar.ozlabs.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id k186-v6sm39087433pfc.142.2018.05.23.02.37.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 02:37:09 -0700 (PDT) Date: Wed, 23 May 2018 19:36:59 +1000 From: Nicholas Piggin To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v9] powerpc/mm: Only read faulting instruction when necessary in do_page_fault() Message-ID: <20180523193659.03857d14@roar.ozlabs.ibm.com> In-Reply-To: <3f8c7feadca2d52fa97c8feb5170c2ab67b6f992.1527065339.git.christophe.leroy@c-s.fr> References: <3f8c7feadca2d52fa97c8feb5170c2ab67b6f992.1527065339.git.christophe.leroy@c-s.fr> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 May 2018 10:53:22 +0200 (CEST) Christophe Leroy wrote: > Commit a7a9dcd882a67 ("powerpc: Avoid taking a data miss on every > userspace instruction miss") has shown that limiting the read of > faulting instruction to likely cases improves performance. > > This patch goes further into this direction by limiting the read > of the faulting instruction to the only cases where it is likely > needed. > > On an MPC885, with the same benchmark app as in the commit referred > above, we see a reduction of about 3900 dTLB misses (approx 3%): > > Before the patch: > Performance counter stats for './fault 500' (10 runs): > > 683033312 cpu-cycles ( +- 0.03% ) > 134538 dTLB-load-misses ( +- 0.03% ) > 46099 iTLB-load-misses ( +- 0.02% ) > 19681 faults ( +- 0.02% ) > > 5.389747878 seconds time elapsed ( +- 0.06% ) > > With the patch: > > Performance counter stats for './fault 500' (10 runs): > > 682112862 cpu-cycles ( +- 0.03% ) > 130619 dTLB-load-misses ( +- 0.03% ) > 46073 iTLB-load-misses ( +- 0.05% ) > 19681 faults ( +- 0.01% ) > > 5.381342641 seconds time elapsed ( +- 0.07% ) > > The proper work of the huge stack expansion was tested with the > following app: > > int main(int argc, char **argv) > { > char buf[1024 * 1025]; > > sprintf(buf, "Hello world !\n"); > printf(buf); > > exit(0); > } > > Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin Thanks, Nick