From patchwork Mon Apr 12 23:27:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12199049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AD66C43460 for ; Mon, 12 Apr 2021 23:28:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5DA4610FC for ; Mon, 12 Apr 2021 23:28:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5DA4610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BD7278D0005; Mon, 12 Apr 2021 19:28:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B392C8D0001; Mon, 12 Apr 2021 19:28:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D7BF8D0005; Mon, 12 Apr 2021 19:28:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 7F28A8D0001 for ; Mon, 12 Apr 2021 19:28:05 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 340856C3E for ; Mon, 12 Apr 2021 23:28:05 +0000 (UTC) X-FDA: 78025305330.27.F729449 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 7220D2000250 for ; Mon, 12 Apr 2021 23:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618270084; 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: in-reply-to:in-reply-to:references:references; bh=QZNkjWqGUr2c+r+eQNLXlEqdsDvAfajNblW+w0OF4x0=; b=cvCDmw2LTHF+uliQH9oRTg/fKiWmALjDkirv7cwWak5QZfWECOZYNvRQTnYFXKoYe6h4eg ppP3fuMx4aery1lOpCy8FebMoppZJGYc6q1l4Ru4BoNF/Of9e7A5Dz+jnev/ehutlyfh4+ HZ/DQtfRQKZCPmSlXNytwhzLPfbEefU= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-3lEkRqqYN-CAOIh_gJ5IZw-1; Mon, 12 Apr 2021 19:28:02 -0400 X-MC-Unique: 3lEkRqqYN-CAOIh_gJ5IZw-1 Received: by mail-qv1-f71.google.com with SMTP id u7so9019677qvf.5 for ; Mon, 12 Apr 2021 16:28:02 -0700 (PDT) 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=QZNkjWqGUr2c+r+eQNLXlEqdsDvAfajNblW+w0OF4x0=; b=M+ybnqiyrD4Qw9xEekFSm4ehXkhjl5d3o5Lo4+dmeq9IQ5dMuOBgjvfvO8XIC2mnyt 146owSF2i8CSi/JWUqV0HdvXU/h8RiqpCWh7BAucPNUuuJUrnzg0T5Xbd9zanEtUjHLJ 81xEIuY1wtbo7jSb5DlKsgH+x4+6YPzTZdLBf9OS0ljFteIjh+8PSa5hJvBp2Vm1MvHC ubvcOLT5dbH7wl/KSYOdX+RLF0R3hpj+6HkQ+nbcbMBUn5+3VPZ5IM1p9t7lp0oj0i// R/xrVyzLFmOIKmYXuQ440aMgcrAhP8KMVrbzYZ28AvJRl+z5/U8Jzk4xqvMcKCIAprYf fGGg== X-Gm-Message-State: AOAM532TJpsiAL1p8U4kO21wBMctDlqcL0Axq40kEuOGBYO5MpYvcATe RbOrHvvDSgE8CAGHObDkuOmi9I3XgHxobzF89jYpeYz2utea0hXQvfUbE8Lp3eXJT6z4xuuhN72 d4AOdGoYJg0vpqVu34NSOb53nrtyDwrWhGCpwiRzofZ3bQAYHdMuDg7gmMrtk X-Received: by 2002:a37:9c4b:: with SMTP id f72mr21700381qke.237.1618270081850; Mon, 12 Apr 2021 16:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfpiRiANOPqvsNsQFND+ji0Hj6p56PD8GmQc4uB6yTcksonIhZ9h9DsI22AiqB9/e/NdWFqA== X-Received: by 2002:a37:9c4b:: with SMTP id f72mr21700356qke.237.1618270081567; Mon, 12 Apr 2021 16:28:01 -0700 (PDT) Received: from xz-x1.redhat.com (bras-base-toroon474qw-grc-88-174-93-75-154.dsl.bell.ca. [174.93.75.154]) by smtp.gmail.com with ESMTPSA id y29sm8958925qtm.13.2021.04.12.16.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 16:28:00 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrea Arcangeli , peterx@redhat.com, Andrew Morton , Mike Rapoport , Axel Rasmussen Subject: [PATCH v2 4/5] userfaultfd/selftests: Only dump counts if mode enabled Date: Mon, 12 Apr 2021 19:27:52 -0400 Message-Id: <20210412232753.1012412-5-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210412232753.1012412-1-peterx@redhat.com> References: <20210412232753.1012412-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 7220D2000250 X-Stat-Signature: s97go1eyebz7xxmys1ru1gi3q8mb5ipw Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618270076-324345 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: 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. Reviewed-by: Axel Rasmussen 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 387b9360ae64..da2374bda5a3 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -171,16 +171,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)