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: 12990386 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E5F2C54EE9 for ; Tue, 27 Sep 2022 11:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231827AbiI0LC3 (ORCPT ); Tue, 27 Sep 2022 07:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231869AbiI0LCA (ORCPT ); Tue, 27 Sep 2022 07:02:00 -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 ESMTPS id 6CC7BB7C3 for ; Tue, 27 Sep 2022 04:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664276489; 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=N2JjCpsbwMVdqxLgpGh5QveNw4DK0sWCZphk8G5c77P+A62rtyPjYqWWmNOwzubor19mm7 lPiEQ6KncO3bOi9Usv4fgalatxFsOWD4yguM9NSCIXE8mqaB1nOBgVoTglnP/9UVR3JnaF IeXj/KKN0A4tV/ciUGh7LatujKGj3QI= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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