Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7332917rwn; Tue, 13 Sep 2022 18:48:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR5vtSTmu3m58xXq2PskXwfS0Ax/GDc5wloL8tRM15ScuKbV/Ryzc/s/CLzMfh5g1Qw29Xtu X-Received: by 2002:a63:e913:0:b0:438:a981:ac64 with SMTP id i19-20020a63e913000000b00438a981ac64mr17853249pgh.463.1663120107486; Tue, 13 Sep 2022 18:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663120107; cv=none; d=google.com; s=arc-20160816; b=rgB62r7EbTBbgyVmkfzVUFpy6wMum6at++0RN4hrEvF4TS63KeZCNO/cf0z5HDUJGT vZ+aeHRVh3L4zmsSsN/VpnUjkIMdJGd5GsMCqxLiaFCF3GNCIhEil1Jj50EwoWT4rsxZ bqMDFckLigo+S/2d6opldmigrOiCQELNc1+CTjWtjF9GZOmadQhkinlMEFwbaNkCWXbz rokHw3ZpzPt6GQdYuzqwBb1cu8KKkddFwQUa2HVfvQqX8D9VQxuxSv6wsfYyRYcIKnyK pYB0+7KSKtES+FOBXyeVsLKEx4ZZhKSanf81lKDzp9FSUqIGmxbtR19gHl9EW/0uWP8u 5VaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=plxos9uquFOD+IvTyP/oZn7J1wpWUgAiZjzQhRQDPPQ=; b=Y0nYTLCZEC5LFB/HeauMDdlVgXtojfPK9p7BIHbkQRTH3l98hmtC4wtU38OaLLIGsd wItlnKfTnaJYcI+xTaDLN1oya2CZOaF2JNGVDkGutZqXV7X38WsSv2c9X9N+IHDPnmSg NLWeeot1c012ajyHVgDLZ9aAW/OP+gN8oB6P3F/Md81goISDhRiviLHo2MSNKOx/l21W Vl1qjRssX6PYFT/4MOHE67zVxLkh6nB6qBNlL+vGFmAssyqB5rEh2jdBJjf9E2l8fANE N4XFHwL8GZlyWTnVuJl377iE1neIb4rwsQ+pQFje8fy4dSWMhOWb0h19psrzb/L880SQ OOZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=b5Ib02Dc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a056a00149500b0050df0383302si12782875pfu.255.2022.09.13.18.48.15; Tue, 13 Sep 2022 18:48:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=b5Ib02Dc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbiINBHv (ORCPT + 99 others); Tue, 13 Sep 2022 21:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiINBHt (ORCPT ); Tue, 13 Sep 2022 21:07:49 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BB4386B3; Tue, 13 Sep 2022 18:07:47 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id s9so7567855qkg.4; Tue, 13 Sep 2022 18:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=plxos9uquFOD+IvTyP/oZn7J1wpWUgAiZjzQhRQDPPQ=; b=b5Ib02DcxbD8iGr+e9uO3ofxDa5NOXUgiKqm4v2kO2kVzLFaIksphZ+L5Zdbvek1wM Wmqq1e6M0COkpEIS2jTy/PtUgCdajEtU48nkMBXp1pD9XDM6s+PucJjIlGaVewK6jpAB MixvjHa8iEwvkFwCTzd4+IiI1JDNHjbquWMgFtpWgjJj6qqEw5WAYPSMVDEgpLo3HNek 36boSZgTaGRXICe0uFLtjuI38uivs5RzA7nLftvI8tOPpKmyKy3pz/VsvafUilaTeUvi fcpstGUbfcwFK2RzmK6KZVIK3Hl4+3OGNIQyl05fWMzuh3cx6pq0kx437GIDICGwdU2D iecg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=plxos9uquFOD+IvTyP/oZn7J1wpWUgAiZjzQhRQDPPQ=; b=o2TZPYe7jrULkGFpNAlRCQDfJDI5Cd99r7HNA2r4A+g5bL1W3rI0TFu2WY5gSHh9jK k3Pjapy6gyiAqfkIh1nElMt3vxI7gut0fLL1f0fSuyZ/8szDlFP9iQaj/DVtHw+0RdW/ VnBqa1Q5D/V72lpo62NjsexQLfnN8xHC2i3dHwufrT/4O+9KazSCF/HX9jP1VRVfCf72 q1aRLRC1nl7N6kMNjp3MgC7bm1st1OseUbmCcfK50mNdUZyl9VmhEf5VuZdA02+xm4uh ECvxaZVGLjwbeDSSQdNQ4XKUiqgnXr4xgmh6RDz0o5VGL0Z/QUjJs8tt+xwVqhcwO3Yk XWng== X-Gm-Message-State: ACgBeo2JpQ1YC5HtqqNpdUjgOhaaj5HPKpNiQKUMJXNTMCHvRz+3YyrQ VZYIqAiGr0Cp+a37Hzsf2QI= X-Received: by 2002:a05:620a:4114:b0:6bb:33c2:45f9 with SMTP id j20-20020a05620a411400b006bb33c245f9mr24395201qko.374.1663117666899; Tue, 13 Sep 2022 18:07:46 -0700 (PDT) Received: from [10.69.40.226] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id bs14-20020a05620a470e00b006b58d8f6181sm707879qkb.72.2022.09.13.18.07.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Sep 2022 18:07:45 -0700 (PDT) Message-ID: <33ff9543-3396-7609-3865-7eed20b853f5@gmail.com> Date: Tue, 13 Sep 2022 18:07:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH 03/21] mm/hugetlb: correct demote page offset logic Content-Language: en-US To: Matthew Wilcox Cc: Andrew Morton , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Mike Kravetz , Muchun Song , Mike Rapoport , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Florian Fainelli , David Hildenbrand , Zi Yan , Oscar Salvador , Hari Bathini , Kees Cook , - , KOSAKI Motohiro , Mel Gorman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux.dev References: <20220913195508.3511038-1-opendmb@gmail.com> <20220913195508.3511038-4-opendmb@gmail.com> From: Doug Berger In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/13/2022 4:34 PM, Matthew Wilcox wrote: > On Tue, Sep 13, 2022 at 12:54:50PM -0700, Doug Berger wrote: >> With gigantic pages it may not be true that struct page structures >> are contiguous across the entire gigantic page. The mem_map_offset >> function is used here in place of direct pointer arithmetic to >> correct for this. > > We're just eliminating mem_map_offset(). Please use nth_page() > instead.That's good to know. I will include that in v2. > >> for (i = 0; i < pages_per_huge_page(h); >> i += pages_per_huge_page(target_hstate)) { >> + subpage = mem_map_offset(page, i); >> if (hstate_is_gigantic(target_hstate))