From patchwork Sat Dec 30 02:56:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13506779 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 87BEEC46CD4 for ; Sat, 30 Dec 2023 02:56:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 23F0D6B0092; Fri, 29 Dec 2023 21:56:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C9686B0134; Fri, 29 Dec 2023 21:56:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0690C6B0136; Fri, 29 Dec 2023 21:56:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E5CC26B0134 for ; Fri, 29 Dec 2023 21:56:44 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B73CCC0284 for ; Sat, 30 Dec 2023 02:56:44 +0000 (UTC) X-FDA: 81621971928.02.889E3FF Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf10.hostedemail.com (Postfix) with ESMTP id 12042C000E for ; Sat, 30 Dec 2023 02:56:41 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=tPcsyogV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of 36YaPZQYKCGgYaXKTHMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36YaPZQYKCGgYaXKTHMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703905002; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=uWd3JqiAE2BBpQa8flrDjVspwGJTFaM7DQZsv7IndQE=; b=PnswIgVLzpqP2Kf/s3/ASMmM3Lm3FnLidnio6L6+Mxs7hf/27oXNnlIpInkvp1cZDspFZ7 T64qSzyGyuklH8fKidBFwZMNGQHAIJ19SRPq3kcjJTW6QJeHMr+AkrSaRjzgqatVI2E1sH rXB6Ny5n6xKucvHvNbvMNCEvDdGzQYw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=tPcsyogV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf10.hostedemail.com: domain of 36YaPZQYKCGgYaXKTHMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=36YaPZQYKCGgYaXKTHMUUMRK.IUSROTad-SSQbGIQ.UXM@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703905002; a=rsa-sha256; cv=none; b=IIQodlWBjQkboebEM2Ks4NSXdRroC/yPVeRPhnX9/jChJVYlxgB0pqFu5Hl2SYyEpG4E6U oikDaqoRCFmIst5Pcyae7e2tICg3y5+pd/7JQ1zUcLFRcblXe/Pb1/1FcsYkBOTcKAJIEW TFMJFqlR3btlZjlvCPTQzOUlADD/8Uk= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dbcd9f4396eso9429494276.0 for ; Fri, 29 Dec 2023 18:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703905001; x=1704509801; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=uWd3JqiAE2BBpQa8flrDjVspwGJTFaM7DQZsv7IndQE=; b=tPcsyogVbMt1inxkHJEEltsGirlBUnTeuVTAXY+s6liCcUPghoSP3wM1x/O/K4WL41 ArmT7ZUsrmByW4q5KDjOjM4IXxIOVVuTupbiu3zPhZ/tihLkkh3votxh3m9WLjkHILPC zglu+ya9o2vP22SO6WCSI07hWpRG46hSRaxnQ6ICGU6iw8QO5D8Nn+51C9hbYCgYyzgB sqgJYs6NSxplAQVHoknY8tOuflb5jiX8hnYNxKXjSW3dv6/7pLNtfoAxDQxAj+ISSvyx 945j/eQWzBTkfiBNbO84Ss31WljXlPq2qIwlR5rhOtSAqDWC9i1VGaPN3ldF8IjqNI9+ RFkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703905001; x=1704509801; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uWd3JqiAE2BBpQa8flrDjVspwGJTFaM7DQZsv7IndQE=; b=pSjrRxFnlTIZCKPE50Al8U6X65/h49FK2wPTdg4BiMEQAUnU333QICllAclI2/5+Pg xCtXpmZ7o9c68+/zJxR4PjiJ+npkO6N+WjVmdsMX+7I7O/kTPz/7ikzBYLHhW3T93sPW e6xyQEUgFLUi5P/pIL4Yn6htibTt2ZgNmgWdk9CmpmK2l2GIuh4VJXWnTSXQjayYMn+5 cOatCssuDms3dJG0LHHoV52nwJjl9kUCKuwLWSwQYEEs7vcZZtmOV2NdrFSVHtNBL0JW qZ0ZLD3tKX37xtaW2S/+dyq63HEWmXd7IeZXyuEa9RnW9BB9oSLIfgGQtGPLk/gQ5H4p OLFg== X-Gm-Message-State: AOJu0YzSg26itlcV7EKKDsDIURavQGUQtHMCwXXgtAKV44jY71oWHtM+ xS+qtHqEpgQHqq7bcSMoc4aFmZwfgkTQzWlVOw== X-Google-Smtp-Source: AGHT+IHRb6MDmtyBRGquDuap6l4J0StnX2Ra/8WXL9DSsV83HHhUqhEmdZo6j2U3K5QEkTzvL3vHZ9ujVYM= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:aa12:a8e:81ce:b04d]) (user=surenb job=sendgmr) by 2002:a05:6902:561:b0:dbd:b59f:217c with SMTP id a1-20020a056902056100b00dbdb59f217cmr4894826ybt.6.1703905001158; Fri, 29 Dec 2023 18:56:41 -0800 (PST) Date: Fri, 29 Dec 2023 18:56:36 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231230025636.2477429-1-surenb@google.com> Subject: [PATCH 1/2] selftests/mm: add separate UFFDIO_MOVE test for PMD splitting From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, shuah@kernel.org, aarcange@redhat.com, lokeshgidra@google.com, peterx@redhat.com, david@redhat.com, ryan.roberts@arm.com, hughd@google.com, mhocko@suse.com, axelrasmussen@google.com, rppt@kernel.org, willy@infradead.org, Liam.Howlett@oracle.com, jannh@google.com, zhangpeng362@huawei.com, bgeffon@google.com, kaleshsingh@google.com, ngeoffray@google.com, jdduke@google.com, surenb@google.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 12042C000E X-Stat-Signature: 63x37x15xzp8e6nbw6mk96y8sdw5xsyx X-HE-Tag: 1703905001-737331 X-HE-Meta: U2FsdGVkX1+C4Nud5sAsoC032wI93Wq5nuu34J8oWCPOpxbtgw0oCsse/ZqHZasNrDZRjR+chH9atYZeKFYIkR90MSaC9uvwPAluYnHr8CPv9azunVD6jj2KAZnozARecoYxyGaaUXpkUh9nW/ISMQ1V/9I0NWJWR7jh5ms80iYJKoR7DTd80qblhUj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TFEUTmYxSkrFZlCg5N16a0ar+ldom12qzrshdfekaPRzSZDHBmoX/eET8+W1jRPmrpxoRKOtG1EMI26n53D/e7wPXY+ak8blYNv4OKNtrI3x6pSTridaQ34pNecNhz6IuWSBl9bnDXwu7BOmNy7039d0UT0cwImto75DTeDbCKIvSv64p1kQLnmDeczQ3xkjoB9ICXe9dCBG4XT0rB4WPh6EUsV/g8ojGVKc2wEJDaHOOHEihdTXjTd2Uzm36ZCooOUcMTb1AYa5UUKUOq8gqRBi9s4Z8+JEH5rrQVp0y0wsA4rAbnkmtGBLG5eRUFy1j+GUnozzko7Cxe5nxMvMKSH4BDYIg8Djl6/Ii8VvH4arGNQOuyX6g/tWNOnsUWI8K9qhuc+wQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add a test for UFFDIO_MOVE ioctl operating on a hugepage which has to be split because destination is marked with MADV_NOHUGEPAGE. With this we cover all 3 cases: normal page move, hugepage move, hugepage splitting before move. Signed-off-by: Suren Baghdasaryan --- Patch applies over mm-unstable. tools/testing/selftests/mm/uffd-unit-tests.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index d8091523c2df..cce90a10515a 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -1199,6 +1199,16 @@ static void uffd_move_test(uffd_test_args_t *targs) static void uffd_move_pmd_test(uffd_test_args_t *targs) { + if (madvise(area_dst, nr_pages * page_size, MADV_HUGEPAGE)) + err("madvise(MADV_HUGEPAGE) failure"); + uffd_move_test_common(targs, read_pmd_pagesize(), + uffd_move_pmd_handle_fault); +} + +static void uffd_move_pmd_split_test(uffd_test_args_t *targs) +{ + if (madvise(area_dst, nr_pages * page_size, MADV_NOHUGEPAGE)) + err("madvise(MADV_NOHUGEPAGE) failure"); uffd_move_test_common(targs, read_pmd_pagesize(), uffd_move_pmd_handle_fault); } @@ -1330,6 +1340,13 @@ uffd_test_case_t uffd_tests[] = { .uffd_feature_required = UFFD_FEATURE_MOVE, .test_case_ops = &uffd_move_test_pmd_case_ops, }, + { + .name = "move-pmd-split", + .uffd_fn = uffd_move_pmd_split_test, + .mem_targets = MEM_ANON, + .uffd_feature_required = UFFD_FEATURE_MOVE, + .test_case_ops = &uffd_move_test_pmd_case_ops, + }, { .name = "wp-fork", .uffd_fn = uffd_wp_fork_test,