From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C597EC4338F for ; Fri, 23 Jul 2021 00:43:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52B4D60EB0 for ; Fri, 23 Jul 2021 00:43:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 52B4D60EB0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6A99D6B005D; Thu, 22 Jul 2021 20:43:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65D5F6B006C; Thu, 22 Jul 2021 20:43:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 548556B0070; Thu, 22 Jul 2021 20:43:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 3EA416B005D for ; Thu, 22 Jul 2021 20:43:14 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DD26723E44 for ; Fri, 23 Jul 2021 00:43:13 +0000 (UTC) X-FDA: 78392003466.11.B417AE4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 4CF3A9001AB3 for ; Fri, 23 Jul 2021 00:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627000992; h=from:from:reply-to: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=IzAgVUDW4F6INuiFdyg/5BoR655vppoe7oB6S9hgdEk=; b=VfH+rnQlLez3v+yXY3Z7Ht1NZkbJbr3fTD0aX5G0fLv1m/IGSGMMk/dlZkNENu1ZmDBBsK YJwfLJ0IYA2yd940aGyT+v8hFEn08LnHP5llJK7I4EoEmG/y3RSZLK0xy/uPXohPGh6Ou7 nIe+gHfZFly7YWWylW3mIwVOdE9TeGM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-MXfsOGNcOt2WfyCpXaBMhA-1; Thu, 22 Jul 2021 20:43:09 -0400 X-MC-Unique: MXfsOGNcOt2WfyCpXaBMhA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A64FA806688; Fri, 23 Jul 2021 00:43:07 +0000 (UTC) Received: from [10.64.54.195] (vpn2-54-195.bne.redhat.com [10.64.54.195]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1EB017A99; Fri, 23 Jul 2021 00:43:04 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v3 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args To: Anshuman Khandual , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, chuhu@redhat.com, shan.gavin@gmail.com References: <20210719130613.334901-1-gshan@redhat.com> <20210719130613.334901-2-gshan@redhat.com> <280a5740-b5dc-4b78-3a38-67e5adbb0afd@redhat.com> <04a4618f-9899-1518-cee1-0a48cb4df4c6@arm.com> <65078a0c-c35c-8e3f-d4d3-3090b0c3daaf@redhat.com> <4a534102-11ff-c849-781e-ed173e46da56@arm.com> From: Gavin Shan Message-ID: <118678e4-b67a-2141-8caa-3bbb9e9cdc19@redhat.com> Date: Fri, 23 Jul 2021 10:43:20 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <4a534102-11ff-c849-781e-ed173e46da56@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4CF3A9001AB3 X-Stat-Signature: mf63fj3uen7au9kkotim7ae5yxrrnqn9 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=VfH+rnQl; spf=none (imf29.hostedemail.com: domain of gshan@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=gshan@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1627000993-841724 Content-Transfer-Encoding: quoted-printable 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: Hi Anshuman, On 7/22/21 5:08 PM, Anshuman Khandual wrote: > On 7/22/21 11:53 AM, Gavin Shan wrote: >> On 7/22/21 2:41 PM, Anshuman Khandual wrote: >>> On 7/21/21 3:50 PM, Gavin Shan wrote: >>>> On 7/21/21 3:44 PM, Anshuman Khandual wrote: >>>>> On 7/19/21 6:36 PM, Gavin Shan wrote: >>>>>> In debug_vm_pgtable(), there are many local variables introduced t= o >>>>>> track the needed information and they are passed to the functions = for >>>>>> various test cases. It'd better to introduce a struct as place hol= der >>>>>> for these information. With it, what the functions for various tes= t >>>>>> cases need is the struct, to simplify the code. It also makes code >>>>>> easier to be maintained. >>>>>> >>>>>> Besides, set_xxx_at() could access the data on the corresponding p= ages >>>>>> in the page table modifying tests. So the accessed pages in the te= sts >>>>>> should have been allocated from buddy. Otherwise, we're accessing = pages >>>>>> that aren't owned by us. This causes issues like page flag corrupt= ion. >>>>>> >>>>>> This introduces "struct pgtable_debug_args". The struct is initial= ized >>>>>> and destroyed, but the information in the struct isn't used yet. T= hey >>>>>> will be used in subsequent patches. >>>>>> >>>>>> Signed-off-by: Gavin Shan >>>>>> --- >>>>>> =C2=A0=C2=A0 mm/debug_vm_pgtable.c | 197 ++++++++++++++++++++++++= +++++++++++++++++- >>>>>> =C2=A0=C2=A0 1 file changed, 196 insertions(+), 1 deletion(-) >>>>>> [...] >>> >>> IIRC it is also not guaranteed that PMD_SHIFT <=3D (MAX_ORDER - 1). H= ence >>> this same scheme should be followed for PMD level allocation as well. >>> >> >> In theory, it's possible to have PMD_SHIFT <=3D (MAX_ORDER - 1) with m= isconfigured >> kernel. I will apply the similar logic to PMD huge page in v4. >> >>>> =C2=A0=C2=A0=C2=A0=C2=A0 [... The code to release the PUD huge page= needs changes based on @args->is_contiguous_pud_page] >>> >>> Right, a flag would be needed to call the appropriate free function. >>> >> >> Yes. We need two falgs for PUD and PMD huge pages separately. >=20 > A single flag should be enough, the order would be dependent on > whether args->pud_pfn or args->pmd_pfn is valid. >=20 Yes, it's correct that one flag is enough as we're sharing the PUD or PMD huge page. Thanks, Gavin