Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5451282pxb; Wed, 26 Jan 2022 12:16:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR4pv/oXlcaXBwMsVR3wWJ+lLkuiS9yNGnDKlC2+NvTqaOOJPvKWIoB6K8OkAY65w4Vu9Q X-Received: by 2002:a17:902:e5cc:: with SMTP id u12mr124137plf.21.1643228185564; Wed, 26 Jan 2022 12:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643228185; cv=none; d=google.com; s=arc-20160816; b=fRXMqi0l1RAqu9Fbif/dWJa0tlE/xna7Y6gWtqJZvfrBCx1kwXJSWXBynoX3g/vkRj 3Szr9aI1wsOmOJNgHn5qWo9GJU3scbhRePdXrpALSPVZl5z7F6TIPkAvWSJfSgH8bCN0 I1iDEmu04YEf+MuaNtidQu9sPJdIdFb14U5nYlAcMNAh4Yo2Qm8Ke4id8PoJjZcU77KL WzvfYwErSXBPu6dP/KcVSPH3Qs65TJJ43uvA6iJYcPh9mQkUXsND0triIa2imkTtgik+ aVvF1z/M+A0w2cOTazuDj0ivCKGCp5+2hIV74ROXUJdQ1dyqfnWnYTFhT7/I3Uv0/geq nZ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=On3Q1c3Qq6iLqOHVi/d/TF+A/Lfpo2wsv2Ihe+ojSJw=; b=mZ+ArHbWYOaqURLBsidDZnI0VhCkPJhNz4+jhU32WHsmXORZa6NLcubUYXLWxktIgT 8ODslgufxLJEPnQAunlCQbMG2AeL5AxruyN60oaBDiVxW736Eq0VGgTsG+Y2JpieaaAD Bn2S10lnRsmMHY9cAn/adrR03SDHMtetqLfhGrDXr/O2g5QDCCyyNwpx92chcI6dgUqM MG13+4ttmczmr7ZQ2MKu4ITPWxW6HLhN59QqAfMBvYqDSHuK/i255mi1eYmreofXU+iT ohToZ7eURzIyii93N/HFC2/UhPuY81U63osElPmOcxkf50LxW46STe5OBEL+79l0Zhe1 KXoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="wNG6D/t1"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si225241pfa.331.2022.01.26.12.16.13; Wed, 26 Jan 2022 12:16:25 -0800 (PST) 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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="wNG6D/t1"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237672AbiAZHQC (ORCPT + 99 others); Wed, 26 Jan 2022 02:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237647AbiAZHQB (ORCPT ); Wed, 26 Jan 2022 02:16:01 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7363C06161C for ; Tue, 25 Jan 2022 23:16:01 -0800 (PST) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + * > + * 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.