Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1105017rdh; Fri, 24 Nov 2023 05:29:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEidjmQwJH/pSR19m6s8IvB9aVkD6YXjDwVagNxdYzLiepq9M/mk7UIdMOJF6GI2Kwi2uSM X-Received: by 2002:a17:902:e743:b0:1cf:a8eb:e272 with SMTP id p3-20020a170902e74300b001cfa8ebe272mr1215058plf.40.1700832572547; Fri, 24 Nov 2023 05:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700832572; cv=none; d=google.com; s=arc-20160816; b=thsedf/y5WidmvLu+/xOuWFcifKPpxNuuiUsCGeR1Evv4CPS3Iig3Jn6tCpeVuhTMa pamDNPP6rn8hdMQwrODm9T1bjmh+Lh82MjFzuP/pmWysCMccROno5XFxVAR7G0+A5Ps/ rKWhKiLsrgkdOwAsaJ4xXNPTL153KdERhNW2N8xcLG63vYxYhpAfdwxSHuV8rzBl1xg4 SW/n1+qv+GI3kRKEpJCb1x6pK79RRyRYK9TMLSdQ1fL2gdg5e7z1Px3q1CvS2ekDgmB2 vRWksJFFZx8y2iKWvIVP8na5/FjZjtaZ4htDZzMFARwfUp5rJzd661aCauK8+8WzkKw1 xP9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qX2dA3aqMotkmkgBnT9s/2Q/bW+jQxPjHk8bIRl2TXE=; fh=UVV9UP3jB+jR+DJP/Pn6IwXb1P9vDh5E3FRL6G+mlkU=; b=F4pkQ0+r0qBKKK0sJhGzwiIIFE/2lMyQftrMw/U7GArPOQV0I4wD7EG3r8iwy/cbyv BY4gT4Z0Y/qmDd+omABHcPDiL+2fmArxO2xp+U+CuGxwatw+3XEZZ5z8A3PwQmBwiuLy Xbw5FTpoBTQ1WTtqUDJ8pGedulC8+oOlJbVKhTTeoGfPYT3IOFZYLTWRK3Xhi7LDlPPV eCwdwG2n9MIGWe1VVYqSHuQ0w9W6k9jkRahxFM7J0hJse9Ik+h0URbuyy1YKnTvo94T8 YrDHN6/9t2/6+4rZBezfPtkm2ZNpaG6/q6+KscAhlLWjrXto6CwdNazi1l7hnw02QRGQ xYWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dQWeGBfK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id iz13-20020a170902ef8d00b001ce5b8c95b0si3271758plb.479.2023.11.24.05.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 05:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dQWeGBfK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8290180816B0; Fri, 24 Nov 2023 05:29:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjKXN3H (ORCPT + 99 others); Fri, 24 Nov 2023 08:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235220AbjKXN2V (ORCPT ); Fri, 24 Nov 2023 08:28:21 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252A619BB for ; Fri, 24 Nov 2023 05:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700832456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qX2dA3aqMotkmkgBnT9s/2Q/bW+jQxPjHk8bIRl2TXE=; b=dQWeGBfKXMPea9Kj/9qHdaRFhs6cbWq9G+QHWZkqxUminddsyiLqg5ILBCnQ+Wo/rkcETm zXzv++mcKEnuIMWkojOJbWVHLodNAEnCEXh1dke6pZ4PN0lLN3o9uK0a0GvPYKHe2/G6SM 4Lpjtx7snDBxf0B4qa2on9d+IaitCvM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-yyv_70-8PeWkL3Q6JW939Q-1; Fri, 24 Nov 2023 08:27:26 -0500 X-MC-Unique: yyv_70-8PeWkL3Q6JW939Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD8A52806053; Fri, 24 Nov 2023 13:27:25 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.194.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE44C2166B2B; Fri, 24 Nov 2023 13:27:22 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Linus Torvalds , Ryan Roberts , Matthew Wilcox , Hugh Dickins , Yin Fengwei , Yang Shi , Ying Huang , Zi Yan , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , "Paul E. McKenney" Subject: [PATCH WIP v1 15/20] mm/rmap_id: verify precalculated subids with CONFIG_DEBUG_VM Date: Fri, 24 Nov 2023 14:26:20 +0100 Message-ID: <20231124132626.235350-16-david@redhat.com> In-Reply-To: <20231124132626.235350-1-david@redhat.com> References: <20231124132626.235350-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 24 Nov 2023 05:29:29 -0800 (PST) Let's verify the precalculated subids for 4/5/6 values. Signed-off-by: David Hildenbrand --- mm/rmap_id.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mm/rmap_id.c b/mm/rmap_id.c index 6c3187547741..421d8d2b646c 100644 --- a/mm/rmap_id.c +++ b/mm/rmap_id.c @@ -481,3 +481,29 @@ void free_rmap_id(int id) ida_free(&rmap_ida, id); spin_unlock(&rmap_id_lock); } + +#ifdef CONFIG_DEBUG_VM +static int __init rmap_id_init(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(rmap_subids_4); i++) + WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_4_MAX_ORDER, i) != + rmap_subids_4[i]); + +#if MAX_ORDER >= RMAP_SUBID_5_MIN_ORDER + for (i = 0; i < ARRAY_SIZE(rmap_subids_5); i++) + WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_5_MAX_ORDER, i) != + rmap_subids_5[i]); +#endif + +#if MAX_ORDER >= RMAP_SUBID_6_MIN_ORDER + for (i = 0; i < ARRAY_SIZE(rmap_subids_6); i++) + WARN_ON_ONCE(calc_rmap_subid(1u << RMAP_SUBID_6_MAX_ORDER, i) != + rmap_subids_6[i]); +#endif + + return 0; +} +module_init(rmap_id_init) +#endif /* CONFIG_DEBUG_VM */ -- 2.41.0