Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5136261pxv; Wed, 28 Jul 2021 04:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQmBGoeSo0dgYMReBKRDIek4KIFzOc8xAXxK8Cd04jdsoiwseQS2yimYbX52IFJHuJBhpB X-Received: by 2002:a92:d112:: with SMTP id a18mr19498452ilb.67.1627470491531; Wed, 28 Jul 2021 04:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627470491; cv=none; d=google.com; s=arc-20160816; b=DZoVzl0EZoDThBdE1Bj2lBOMHpABZnABFY96oE0GDcHjBTmEL7ctX/z84a2OfIrDgN 5/hHI7x9bSWeMTzLZPVW4WlYtQ02QT0OZAhYbRo+iP3Qr3L74Y5VbYogIT1kVe+Zj12p iTkZ96NBEu7iExg39ij0OACPNDi4vhYXS77Ays4Hrljbroc8us5RcWcCH+VuapdngARu bHmquz4nGTVeOvS6sAHecm+vKlBaiXE2C36q+SaBkeApvphGuZOJgS+TNJvBpB+qXRiW eQXPcawhxZ95MMQQiALOA9iu73OJkFNpSJnHhzv3R2GFReKzod9iPZMZ8SanNbyabeGZ 1FqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=f6bPNFi+rv1aP9OoKeY4ITqqEhd2DrfqqLJraEy4Dpc=; b=G0lZyl1hBcS+cz0zDh7Lh4MaxtvCV3FI2UY/zlk8lZ1ioQeURZoRLBgCH7CjiMwjWW xHBE0K1NJ8MIapOuTu5tH6bXWayhyZ8ByXv1dBO/YafC/dkI9dONGRFUvcsLCOHfYm0m VNzeB306lcZUfFCSuKgnS8sLXiw1PSdCfNS5Gh9/nE49Q8o58U2PrBdr5x4ClDufCc1V rJNI6VRasobyOkNu9DvLZ7XV/EelyOLdN9Tx86fpJ+nu4lp1f9mTc82r4r6vdMkaxAOi osiYr+xWHP9p0pZp6thJ+ckIHLKo2w0EF7IE0B/6Z5ZgrODB90LlYoHywPDUHjI21kf3 z8JQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si6319822jak.102.2021.07.28.04.07.59; Wed, 28 Jul 2021 04:08:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234283AbhG1LHS (ORCPT + 99 others); Wed, 28 Jul 2021 07:07:18 -0400 Received: from foss.arm.com ([217.140.110.172]:55138 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231994AbhG1LHS (ORCPT ); Wed, 28 Jul 2021 07:07:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B56C631B; Wed, 28 Jul 2021 04:07:16 -0700 (PDT) Received: from [10.163.65.183] (unknown [10.163.65.183]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5B3773F66F; Wed, 28 Jul 2021 04:07:13 -0700 (PDT) Subject: Re: [PATCH v4 06/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in migration and thp tests To: Gavin Shan , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, gerald.schaefer@linux.ibm.com, aneesh.kumar@linux.ibm.com, christophe.leroy@csgroup.eu, cai@lca.pw, catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, chuhu@redhat.com, shan.gavin@gmail.com References: <20210727061401.592616-1-gshan@redhat.com> <20210727061401.592616-7-gshan@redhat.com> From: Anshuman Khandual Message-ID: <39de75d2-744a-9194-cbc2-14926b60e68e@arm.com> Date: Wed, 28 Jul 2021 16:38:02 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210727061401.592616-7-gshan@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/21 11:43 AM, Gavin Shan wrote: > This uses struct pgtable_debug_args in the migration and thp test > functions. It's notable that the pre-allocated page is used in > swap_migration_tests() as set_pte_at() is used there. > > Signed-off-by: Gavin Shan > --- > mm/debug_vm_pgtable.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index bc153cad9045..9136195efde3 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -845,7 +845,7 @@ static void __init pmd_swap_tests(struct pgtable_debug_args *args) > static void __init pmd_swap_tests(struct pgtable_debug_args *args) { } > #endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */ > > -static void __init swap_migration_tests(void) > +static void __init swap_migration_tests(struct pgtable_debug_args *args) > { > struct page *page; > swp_entry_t swp; > @@ -861,9 +861,10 @@ static void __init swap_migration_tests(void) > * problematic. Lets allocate a dedicated page explicitly for this > * purpose that will be freed subsequently. > */ > - page = alloc_page(GFP_KERNEL); > + page = (args->pte_pfn != ULONG_MAX) ? > + pfn_to_page(args->pte_pfn) : NULL; > if (!page) { > - pr_err("page allocation failed\n"); > + pr_err("no page available\n"); > return; > } Please check for a valid page earlier in the function and return. Otherwise this calls out the page unavailability (after starting the test), which is inconsistent with all other functions like pxx_advanced_tests(). [ 1.051633] debug_vm_pgtable: [pte_swap_tests ]: Validating PTE swap [ 1.052697] debug_vm_pgtable: [pmd_swap_tests ]: Validating PMD swap [ 1.053765] debug_vm_pgtable: [swap_migration_tests ]: Validating swap migration <===== [ 1.054900] debug_vm_pgtable: [swap_migration_tests ]: no page available <===== Should do this just before pr_info("Validating swap migration\n"). ...... page = (args->pte_pfn != ULONG_MAX) ? pfn_to_page(args->pte_pfn) : NULL; if (!page) return; .....