Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp841615pxb; Fri, 22 Apr 2022 12:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykuPOI8TKKS5FKW7G1C0ezlpR0wELm0J5QVCIj/Upstw4lN7Or8oeMbxc18Upmu3zIAAnY X-Received: by 2002:a17:90b:4d88:b0:1d2:a753:479d with SMTP id oj8-20020a17090b4d8800b001d2a753479dmr18208022pjb.12.1650655213700; Fri, 22 Apr 2022 12:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650655213; cv=none; d=google.com; s=arc-20160816; b=GsVakb752+akTG3U0wgrCsZZpYHqGX4Zd6RfWlbBdWVi/ChBPa+kms5feTvscffH+Q U7vw6hBrw7EwBcJPzxpcCh/0LL1u/7u7om33RjF+dZR3i9PF/zQ7pG5ftVkldeMKaw9U nUkALNvU3+AkdWl4rvch0AvGpdevaFJ7cJQ5mJrvSvm882bftGGKNGPIiW1rt2vW+g++ ZeJf+RkVKDN7wu8b9bSMcYm2Nu7S/zk2b4AVe9PQ7fJ74ZoQ7FaSnNrG3JYZkjKTXPcx C5AagdC7U9UhBGEND2LLDxwktrQhkD+Ps99YrbrWzu1NL9NCra651dW7j74GzW9O3lym Ym9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=92MeHe1O2XEwswakE1YC1636cVBjLw+9Sy+IL3NtyVk=; b=z5ZDZzCKZte8TIhCvghClaqbrORt6r6PoUP0S+KNYqsr3E8k80BfvBof40dmAyrux8 sHyJgSTf4INcdRg7kyhapwdbFUgx9NVDd+O3/G6wprAivMiV6wODyvQDtgxLqVn2R08o 9qX/0ymP8jNRYKqn5VArDtPeSqLjIl+AZFTDXU+wMglMiiUOvE++mq7iy1gvqQYwebMj XDz4wKRn/mIyA7DwibBVSWSWXCggD+wLwnSW3BrPYQxUXLP5Ywh51+K+Y711hvnKMpIO o32u1MEuQKebN776wMaBRbz31pRVcepdJWnWeXfcAMiM8tVkmQhQjrI0a/Fl6oyyFSDA s17Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OyskmkGB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d17-20020a056a00199100b004fb47469b7asi8703461pfl.87.2022.04.22.12.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:20:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OyskmkGB; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D27D81C0513; Fri, 22 Apr 2022 11:34:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387257AbiDUJJY (ORCPT + 99 others); Thu, 21 Apr 2022 05:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387248AbiDUJJU (ORCPT ); Thu, 21 Apr 2022 05:09:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EAC6822B24 for ; Thu, 21 Apr 2022 02:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650531989; 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=92MeHe1O2XEwswakE1YC1636cVBjLw+9Sy+IL3NtyVk=; b=OyskmkGBvqm2D1jUs23VQOOBVJhA44Fvr+GPjEDj+S8LBDKwiQIctwUk64ADfbRe9MYlEi U/EqxHVlf93cpSJIN30EBzkKhN8z+/viiUdVqztQ5sEoof7GCu4Kvg0oL0qwJXFAg+xu2g 1Q00hrSD63s84l/VLeqPZu8T/TW/jSo= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-190-lo6MelUOOdirx1-2n3Iapw-1; Thu, 21 Apr 2022 05:06:27 -0400 X-MC-Unique: lo6MelUOOdirx1-2n3Iapw-1 Received: by mail-wr1-f71.google.com with SMTP id 46-20020adf8031000000b00207ad3febaeso924654wrk.6 for ; Thu, 21 Apr 2022 02:06:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=92MeHe1O2XEwswakE1YC1636cVBjLw+9Sy+IL3NtyVk=; b=CdTYSSL+MKo8V6lKVXZVpCMr/p7qkFUGLpZXdcHx5AARS7T4heKyBG25BcG418DqD8 Rk798yeMEv6QlEM5nr+PEvHzUzLjCb3ppBMhsRtmzsbMXRSTw7DCZ27NMbJYkYloufTQ aE8nQJfZfGUAJpAXSWsh14XmV4cV854qVhlelWDDc/Ds0I47QMZ+01FRTb/LPqnb6bs6 keeH46IzdQNI2zfx7/M6JzSSqKZ9Mj/smD6b9KLdd7I0F+bSQU1sTSciHOwmZJzwy28A WPpaWvWrR2lloyiktbcooXPVNtPjnOhnV7Tv2DOLk97NqIVZrdAOWLcsQ357CAJDhHfY jGDg== X-Gm-Message-State: AOAM5300s8TJjrk3ngG80dud+sIFNj7CDhgKj5dUL8bYPZNyYh8wsedb 3EZVaaGiHgPzu3vjH4E8P2EYit5lFt6cqTuPR67g9NzBWoXy1ZvILM6hIRitfclbpVbgHA37jF5 FqYG8ca+ig51vfdQme1KDpO0F X-Received: by 2002:a7b:c5d0:0:b0:389:fe85:3d79 with SMTP id n16-20020a7bc5d0000000b00389fe853d79mr7663483wmk.77.1650531986431; Thu, 21 Apr 2022 02:06:26 -0700 (PDT) X-Received: by 2002:a7b:c5d0:0:b0:389:fe85:3d79 with SMTP id n16-20020a7bc5d0000000b00389fe853d79mr7663463wmk.77.1650531986214; Thu, 21 Apr 2022 02:06:26 -0700 (PDT) Received: from ?IPV6:2003:cb:c702:de00:711b:76af:b335:9b70? (p200300cbc702de00711b76afb3359b70.dip0.t-ipconnect.de. [2003:cb:c702:de00:711b:76af:b335:9b70]) by smtp.gmail.com with ESMTPSA id c11-20020a05600c0a4b00b0037c91e085ddsm1798885wmq.40.2022.04.21.02.06.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Apr 2022 02:06:24 -0700 (PDT) Message-ID: <707ad285-349c-9788-51dc-12f7caf77f11@redhat.com> Date: Thu, 21 Apr 2022 11:06:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v6 1/2] selftests: vm: bring common functions to a new file Content-Language: en-US To: Muhammad Usama Anjum , Andrew Morton , Shuah Khan Cc: kernel@collabora.com, krisman@collabora.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20220420084036.4101604-1-usama.anjum@collabora.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220420084036.4101604-1-usama.anjum@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.04.22 10:40, Muhammad Usama Anjum wrote: > Bring common functions to a new file while keeping code as much same as > possible. These functions can be used in the new tests. This helps in > avoiding code duplication. > > Signed-off-by: Muhammad Usama Anjum > --- > Changes in V6: > - Correct header files inclusion > > Changes in V5: > Keep moved code as same as possible > - Updated macros names > - Removed macro used to show bit number of dirty bit, added a comment > instead > - Corrected indentation > --- > tools/testing/selftests/vm/Makefile | 7 +- > tools/testing/selftests/vm/madv_populate.c | 34 +----- > .../selftests/vm/split_huge_page_test.c | 79 +------------ > tools/testing/selftests/vm/vm_util.c | 108 ++++++++++++++++++ > tools/testing/selftests/vm/vm_util.h | 9 ++ > 5 files changed, 124 insertions(+), 113 deletions(-) > create mode 100644 tools/testing/selftests/vm/vm_util.c > create mode 100644 tools/testing/selftests/vm/vm_util.h > > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile > index 5e43f072f5b76..4e68edb26d6b6 100644 > --- a/tools/testing/selftests/vm/Makefile > +++ b/tools/testing/selftests/vm/Makefile > @@ -34,7 +34,7 @@ TEST_GEN_FILES += hugepage-mremap > TEST_GEN_FILES += hugepage-shm > TEST_GEN_FILES += hugepage-vmemmap > TEST_GEN_FILES += khugepaged > -TEST_GEN_FILES += madv_populate > +TEST_GEN_PROGS = madv_populate > TEST_GEN_FILES += map_fixed_noreplace > TEST_GEN_FILES += map_hugetlb > TEST_GEN_FILES += map_populate > @@ -47,7 +47,7 @@ TEST_GEN_FILES += on-fault-limit > TEST_GEN_FILES += thuge-gen > TEST_GEN_FILES += transhuge-stress > TEST_GEN_FILES += userfaultfd > -TEST_GEN_FILES += split_huge_page_test > +TEST_GEN_PROGS += split_huge_page_test > TEST_GEN_FILES += ksm_tests > > ifeq ($(MACHINE),x86_64) > @@ -91,6 +91,9 @@ TEST_FILES := test_vmalloc.sh > KSFT_KHDR_INSTALL := 1 > include ../lib.mk > Acked-by: David Hildenbrand BTW, I realized that my madv_populate test fails when run without softdirty support in the kernel. Eventually we should sense support somehow and skip softdirty tests. Maybe we can sense by writing to some page and then testing if the page is reported as softdirty. If it isn't, we know the kernel doesn't support it (or is extremely buggy :D ). Such a sense check would be common functionality in the helper file as well. -- Thanks, David / dhildenb