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 E9A01C2BA4C for ; Wed, 26 Jan 2022 07:16:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3380B6B0074; Wed, 26 Jan 2022 02:16:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E78E6B0075; Wed, 26 Jan 2022 02:16:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FE006B0078; Wed, 26 Jan 2022 02:16:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 112446B0074 for ; Wed, 26 Jan 2022 02:16:04 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C5988183E4B70 for ; Wed, 26 Jan 2022 07:16:03 +0000 (UTC) X-FDA: 79071579006.15.C522525 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 9A320160004 for ; Wed, 26 Jan 2022 07:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=On3Q1c3Qq6iLqOHVi/d/TF+A/Lfpo2wsv2Ihe+ojSJw=; b=wNG6D/t1xfJGpmlDQ1D1VlIFTq ydXXhcg/jpP0aLcvm/COST+BusNZQ9+cOweLaQHnChaOvVJNcz5cutJZpyaTbveGaBbu9icU+HmJK mLOrTOwRdAvZrp7uRyOaeZfGdgXjezRe/2BpYz3qM45VIiqEdYYWMkNOb2hf26PAAOUHrmgy16D8W vhKmCbKfJavS7D+GXzZt2ZEoS+/yK9twIvauiBVAWgjswFzzzP+4+m6tCExHTucvNTCW0uTGSzrVg aha/3ZQCa9Rz7xwu7+1zPPgrZjlDzDpNuhdzRyR7KJsXOVp03Xua+B50mzvOXQKvgkPJiEgsPLZfR xDaQ6wCA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCcX8-00ASZv-Qt; Wed, 26 Jan 2022 07:15:58 +0000 Date: Tue, 25 Jan 2022 23:15:58 -0800 From: Christoph Hellwig To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, hch@infradead.org, akpm@linux-foundation.org Subject: Re: [RFC V1 01/31] mm/debug_vm_pgtable: Directly use vm_get_page_prot() Message-ID: References: <1643029028-12710-1-git-send-email-anshuman.khandual@arm.com> <1643029028-12710-2-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1643029028-12710-2-git-send-email-anshuman.khandual@arm.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9A320160004 X-Stat-Signature: 6si8nme5i1zrjbe4d8gfgmrg4hcptcop Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="wNG6D/t1"; dmarc=none; spf=none (imf08.hostedemail.com: domain of BATV+2ed252487af0c8944991+6730+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+2ed252487af0c8944991+6730+infradead.org+hch@bombadil.srs.infradead.org X-HE-Tag: 1643181361-516375 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: > + * > + * 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.