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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE7ADC433EF for ; Thu, 27 Jan 2022 04:16:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 423976B0078; Wed, 26 Jan 2022 23:16:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D2306B007B; Wed, 26 Jan 2022 23:16:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C1866B007D; Wed, 26 Jan 2022 23:16:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 1AA116B0078 for ; Wed, 26 Jan 2022 23:16:21 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BF099181CA76E for ; Thu, 27 Jan 2022 04:16:20 +0000 (UTC) X-FDA: 79074754920.22.6909C77 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id A1D5F1A0005 for ; Thu, 27 Jan 2022 04:16:19 +0000 (UTC) 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 C4BD31FB; Wed, 26 Jan 2022 20:16:18 -0800 (PST) Received: from [10.163.42.218] (unknown [10.163.42.218]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 14F723F7D8; Wed, 26 Jan 2022 20:16:16 -0800 (PST) Subject: Re: [RFC V1 01/31] mm/debug_vm_pgtable: Directly use vm_get_page_prot() To: Christoph Hellwig Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org References: <1643029028-12710-1-git-send-email-anshuman.khandual@arm.com> <1643029028-12710-2-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <1f75e638-7b72-1c1b-c493-eb4b62dcf280@arm.com> Date: Thu, 27 Jan 2022 09:46:23 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A1D5F1A0005 X-Stat-Signature: 38masjbyqnrp8iy4w89467w4nm5iaf4f Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspam-User: nil X-HE-Tag: 1643256979-25980 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/26/22 12:45 PM, Christoph Hellwig wrote: >> + * >> + * Protection based vm_flags combinatins are always linear >> + * and increasing i.e VM_NONE ..[VM_SHARED|READ|WRITE|EXEC]. >> */ >> - for (idx = 0; idx < ARRAY_SIZE(protection_map); idx++) { >> + for (i = VM_NONE; i <= (VM_SHARED | VM_READ | VM_WRITE | VM_EXEC); ix++) { >> pte_basic_tests(&args, idx); >> pmd_basic_tests(&args, idx); >> pud_basic_tests(&args, idx); > > This looks rather convoluted. I'd prefer to add a helper for the body > of this loop, and then explicitly call it for all the valid > combinations. Right now all are valid, so this dosn't change a thing > except for generating larger code due to the explicit loop unrolling, > but I think it is much easier to follow and maintain. IIUC, then will just keep this unchanged.