From patchwork Tue Sep 27 11:01:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 12990398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6350CC07E9D for ; Tue, 27 Sep 2022 11:01:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF0C38E00C3; Tue, 27 Sep 2022 07:01:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC7CA8E00C1; Tue, 27 Sep 2022 07:01:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B908A8E00C3; Tue, 27 Sep 2022 07:01:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AA9F08E00C1 for ; Tue, 27 Sep 2022 07:01:29 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4C0D11A0DB2 for ; Tue, 27 Sep 2022 11:01:29 +0000 (UTC) X-FDA: 79957574298.18.B484199 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id DF19C18001D for ; Tue, 27 Sep 2022 11:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664276487; 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; bh=3xgDb8D/3EHICRWKuyfoBAlGnicVQATCL19Alr25P2c=; b=N6Dxw9wC4sEkeyKzrCFr1xNlnayYLHkEhv3PziM70PibFYCB0H9GZlgdtii4BID6Z17Y+Q iOtU/NZFMpaa9dxP9LkUGSPUH86jeRFSyIuepAdzUFh4SY1j5kCWCYykKPCg0lhaJo6IF8 6cdGc+OQ+YvtQ+XxY0K5E42iKY/xRTw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-vgVRod4zOGm8GofJPuq0Hg-1; Tue, 27 Sep 2022 07:01:25 -0400 X-MC-Unique: vgVRod4zOGm8GofJPuq0Hg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 583E0800186; Tue, 27 Sep 2022 11:01:25 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.194.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2D58C15BAB; Tue, 27 Sep 2022 11:01:21 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, David Hildenbrand , Andrew Morton , Shuah Khan , Jason Gunthorpe , John Hubbard , Nadav Amit , Peter Xu , Andrea Arcangeli , Vlastimil Babka , Mike Rapoport , Christoph von Recklinghausen , Don Dutile Subject: [PATCH v1 0/7] selftests/vm: test COW handling of anonymous memory Date: Tue, 27 Sep 2022 13:01:13 +0200 Message-Id: <20220927110120.106906-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=N6Dxw9wC; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664276488; a=rsa-sha256; cv=none; b=tHIxVwwRttfAY0sDmUcv//SjIcChZZr+yrDfQ2xvju4d1iCpC3ihQaGE+sImPAxeh8VZ+y yGLd/5NglDs/TKUEzBRSQfLx22VDx2OiK4ivCDMfEFtl0OqvyTbTKKEKvu7WmFpLczAoSE B9XOF/ziXu15VzAkZh0Yu6/UtEfiCKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664276488; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=3xgDb8D/3EHICRWKuyfoBAlGnicVQATCL19Alr25P2c=; b=8DcDU8fRpeG0cIumPb57XEAHvrPE8oPJ6lWVqRx5rQtU9ra3MjnkoHLeanWDP1ugJQhem2 5uzJBIa+/+c11Yt4cM4ToYgkjzm9glK9eePJMIjgVf3lupM4SHBw2jQfskwOO+P/icEzn+ SrhI8lHVY5+b0NyNG7bVHNI8j9/e8KU= Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=N6Dxw9wC; spf=pass (imf24.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: DF19C18001D X-Stat-Signature: ryracbg1ofj4m48ihto73tx9eix6eptb X-HE-Tag: 1664276487-306807 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: On top of mm-stable. This is my current set of tests for testing COW handling of anonymous memory, especially when interacting with GUP. I developed these tests while working on PageAnonExclusive and managed to clean them up just now. On current upstream Linux, all tests pass except the hugetlb tests that rely on vmsplice -- these tests should pass as soon as vmsplice properly uses FOLL_PIN instead of FOLL_GET. I'm working on additional tests for COW handling in private mappings, focusing on long-term R/O pinning e.g., of the shared zeropage, pagecache pages and KSM pages. These tests, however, will go into a different file. So this is everything I have regarding tests for anonymous memory. Cc: Andrew Morton Cc: Shuah Khan Cc: Jason Gunthorpe Cc: John Hubbard Cc: Nadav Amit Cc: Peter Xu Cc: Andrea Arcangeli Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Christoph von Recklinghausen Cc: Don Dutile David Hildenbrand (7): selftests/vm: anon_cow: test COW handling of anonymous memory selftests/vm: factor out pagemap_is_populated() into vm_util selftests/vm: anon_cow: THP tests selftests/vm: anon_cow: hugetlb tests selftests/vm: anon_cow: add liburing test cases mm/gup_test: start/stop/read functionality for PIN LONGTERM test selftests/vm: anon_cow: add R/O longterm tests via gup_test mm/gup_test.c | 140 +++ mm/gup_test.h | 12 + tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 25 +- tools/testing/selftests/vm/anon_cow.c | 1126 ++++++++++++++++++++ tools/testing/selftests/vm/check_config.sh | 31 + tools/testing/selftests/vm/madv_populate.c | 8 - tools/testing/selftests/vm/run_vmtests.sh | 3 + tools/testing/selftests/vm/vm_util.c | 15 + tools/testing/selftests/vm/vm_util.h | 2 + 10 files changed, 1353 insertions(+), 10 deletions(-) create mode 100644 tools/testing/selftests/vm/anon_cow.c create mode 100644 tools/testing/selftests/vm/check_config.sh