Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp84439pxb; Tue, 9 Mar 2021 16:46:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfdF+pqLIuc2w5bmqnXCxU1yA/z25misz4ssT2zpclXtwY4GARi8MXAGvtAAyVVpLOjnAt X-Received: by 2002:a17:906:f296:: with SMTP id gu22mr766531ejb.20.1615337211535; Tue, 09 Mar 2021 16:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615337211; cv=none; d=google.com; s=arc-20160816; b=PKST5hxWqGZtR4WKcAUKgMAH6CQsbFt/SNqGXKmEbWReTH0L5aoNByk3yxF/eSydtC QJmm1yTD7AgHv4eHVqhvIvnjj72U/vCc+5IZCKVOSdkJ/C99CB5WVpIzfFOTCN42RlRH 8V0P15ibPPeBf79KLug5DXZ3tyamUm+hWtKm8FfI2Nx/bxWLPaRdyZ1BGCECBaetQi3+ 7VhaN1457x0iCNdYXN7A1fFapPFYULlEHOgaqr55QNBu4AH7D0xKKN0Bv46ibgPctSHs DRKTjpnN5fK8s4bh9L8UCOSxtkGS47W+JJllne3W4YsHik0rbfKFBfgerQWDRJ/IIjZF RTZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JFLVZpqIxshqGVHv9ZZ+a47BjDat3dahvnPbwqiCdNA=; b=kvJomGeJd7EuX0U6vVVCLBuWO01V6QS4K9HDgc3kMxwxyhIPUIYhGpuGtNruWMZcjh EEkMalFDYMRRTGc6MvvX0mR+9O6WSPAqpGre3RcoxReAivh1QjipPFFGBhpmk137b5Ot CYt+2zSo9SSs4aY2lODH1RsmWhkcrmfBtyCxrVGV+6YLH/67ISOoX+uCat8KD+YM0tYS 9klFHBnSZPUmAniFo1Avom3O0JeExIOauNJKERDnwV3jQkuQIvxqCtO+IFS3ttoY+Aob 9NulMTF8l2UKyVK45L75UC2IC3MAZOsrecKfrSiytsa66kgENKpqBlth5lbS77Rxs794 meYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BZZt4TRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si7901602edw.354.2021.03.09.16.46.29; Tue, 09 Mar 2021 16:46:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BZZt4TRr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbhCJAph (ORCPT + 99 others); Tue, 9 Mar 2021 19:45:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46212 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231341AbhCJApU (ORCPT ); Tue, 9 Mar 2021 19:45:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615337119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JFLVZpqIxshqGVHv9ZZ+a47BjDat3dahvnPbwqiCdNA=; b=BZZt4TRr+dA+X2FnrOq2fg/s+ix8JhdNLNiYKnU3b3WgeENwFto0BC/Eko44E0c56l9m7Y cVsN3z7cGK9RIW2MHqAERFsRH8NuYNcOQ/Q2Qq6qbkSlSPRD5ZhYonyJhIf22pQyqIwSQS cmbjMOri31N91ZkGTse7oxppoUt7o24= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-570-gniZXdfyM7i9skjeQaCZ1A-1; Tue, 09 Mar 2021 19:45:18 -0500 X-MC-Unique: gniZXdfyM7i9skjeQaCZ1A-1 Received: by mail-qt1-f197.google.com with SMTP id l63so8316037qtd.23 for ; Tue, 09 Mar 2021 16:45:18 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=JFLVZpqIxshqGVHv9ZZ+a47BjDat3dahvnPbwqiCdNA=; b=BxNhlwMnqrzbkMHJRdj7dI3IJEsJbphJlnEpzWaRehLZVc4i+OkwzcgzQ0h2Q4bfC9 mOLbRVG+wy006h3e1W4kdJ26gbQf1R91Vr594GILd0l/yt0dyGb/ZA9vCBbuWXM0sHTp CZCDgth4sNLGg80wwVRPhf/2fhpN2Az+pAZiFVekGIAl26Ds/xil19z3GgpGX+w4ap6G 09VtxIwEtT7REs87PJi17ITkD2aUqW8HCQvGW7cMsqzcX8EuFIPzWoxA9lqvJRiSk7/2 Fq3MxMwOY/6a+orlgG1Op2Sas4N2CltGpDgfCyAcss6Da6+Vryf2VyNoGTeKgvDAP139 dctQ== X-Gm-Message-State: AOAM533mPsQBohw8DIygfu/8bu8GyDVflgVP7Qs6tefnE7uzMxxZ51QU /Xp4Li9hUzj9ZIPp1IdujxHgDKWi7sa13CiW7zwnOhOUSxAs0lPATiJhtQRy56FWuIHYW0hEuSD IiYfKZKcKCftN+zpSv+pLedr3 X-Received: by 2002:a05:6214:10e7:: with SMTP id q7mr791953qvt.16.1615337117801; Tue, 09 Mar 2021 16:45:17 -0800 (PST) X-Received: by 2002:a05:6214:10e7:: with SMTP id q7mr791941qvt.16.1615337117618; Tue, 09 Mar 2021 16:45:17 -0800 (PST) Received: from xz-x1.redhat.com (bras-vprn-toroon474qw-lp130-25-174-95-95-253.dsl.bell.ca. [174.95.95.253]) by smtp.gmail.com with ESMTPSA id b27sm11418173qkl.102.2021.03.09.16.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 16:45:17 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Axel Rasmussen , Andrew Morton , peterx@redhat.com, Andrea Arcangeli , Nadav Amit Subject: [PATCH 4/5] userfaultfd/selftests: Only dump counts if mode enabled Date: Tue, 9 Mar 2021 19:45:10 -0500 Message-Id: <20210310004511.51996-5-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210310004511.51996-1-peterx@redhat.com> References: <20210310004511.51996-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WP and MINOR modes are conditionally enabled on specific memory types. This patch avoids dumping tons of zeros for those cases when the modes are not supported at all. Signed-off-by: Peter Xu --- tools/testing/selftests/vm/userfaultfd.c | 30 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index cf0cd4cb327d..5f89d258024a 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -173,16 +173,26 @@ static void uffd_stats_report(struct uffd_stats *stats, int n_cpus) minor_total += stats[i].minor_faults; } - printf("userfaults: %llu missing (", miss_total); - for (i = 0; i < n_cpus; i++) - printf("%lu+", stats[i].missing_faults); - printf("\b), %llu wp (", wp_total); - for (i = 0; i < n_cpus; i++) - printf("%lu+", stats[i].wp_faults); - printf("\b), %llu minor (", minor_total); - for (i = 0; i < n_cpus; i++) - printf("%lu+", stats[i].minor_faults); - printf("\b)\n"); + printf("userfaults: "); + if (miss_total) { + printf("%llu missing (", miss_total); + for (i = 0; i < n_cpus; i++) + printf("%lu+", stats[i].missing_faults); + printf("\b) "); + } + if (wp_total) { + printf("%llu wp (", wp_total); + for (i = 0; i < n_cpus; i++) + printf("%lu+", stats[i].wp_faults); + printf("\b) "); + } + if (minor_total) { + printf("%llu minor (", minor_total); + for (i = 0; i < n_cpus; i++) + printf("%lu+", stats[i].minor_faults); + printf("\b)"); + } + printf("\n"); } static int anon_release_pages(char *rel_area) -- 2.26.2