Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8561226rwp; Wed, 19 Jul 2023 11:36:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlFh5g9Ldarq52paMCBBM4pDlFBddznBrRZ7d4jpKXMIRq0wUFPxd3N/NOCyh5GMOgsaKckM X-Received: by 2002:a17:906:77d6:b0:993:d617:bdc8 with SMTP id m22-20020a17090677d600b00993d617bdc8mr3441251ejn.7.1689791761007; Wed, 19 Jul 2023 11:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689791760; cv=none; d=google.com; s=arc-20160816; b=JX45aRnB2ifCXM3HynKp6+jIjmjmQkQHECe2VddMBLd0CeIPhseGHTXFM4ZPZce6LG S2YbDuBiTz1PAAUR0axzSLuzOMhAqRMxwkAZJh0KVn8l8R1Yz5Y0qWH50V+c1i22daC9 rQJlCOaW/oJQ4mhpLFZwKCghh1sfvHhAYANQ0nZnnfJP/e+fwN5THuA46RbaLCl9I5Bk xqx/x4T45IcwxOM2CJ5POQnogO5wX1+X+TYXiMeq2P+XO/AwzCZq87qsEYXI99RZaDew E1KAGMqI0TTXSV+L+o5cg1cWuTFnwpDAiKHoHvgIgfZnnR8gKpJr8broMePN4LsWDLuq /e3g== 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=kk5QZGiEytes23SJ/m2wKXRoxkJuL/JZms+EeEgVKw4=; fh=uABTKhD/4YRfKqI6opijInTDyAvKVGnPvJERKzUITvI=; b=u9wfWF5Rv0LT5YNEaTDYm0ziWt+GufNaq0ZTiGSCxqGQuRsBJvcX0TWC48tT32i6QB bHKJscJoakis1UUdPMLwUhDRU0dgpTNPDltPHUqG2PD1Y/zkLiNqGi5pcHaaZeLzslAs PZNHQE7x7gFHSnimx3vGd68X8S6Al2SQA/omuFf4tsE+yOJEcnLTsBnPw10OaKefQmci zwLv7GqTCOdKCgAmBAoXcqU6VvZDiAA4ndUwEBv5BZBviY+VHn1CT4cmbcy+xrL4mmWt Vk4Idzx/MWmLp3mQl1lSCIHoFPYfKeM80vkRERipxwfU2Ucgi6Ae6WpTCZRwXHw+cUjF 2Y5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PJd5FNKR; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qn8-20020a170907210800b00992ee6da8e7si3058039ejb.740.2023.07.19.11.35.36; Wed, 19 Jul 2023 11:36:00 -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=@infradead.org header.s=casper.20170209 header.b=PJd5FNKR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbjGSSMF (ORCPT + 99 others); Wed, 19 Jul 2023 14:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbjGSSME (ORCPT ); Wed, 19 Jul 2023 14:12:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DE1311C for ; Wed, 19 Jul 2023 11:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=kk5QZGiEytes23SJ/m2wKXRoxkJuL/JZms+EeEgVKw4=; b=PJd5FNKRXZKyTYWisyfy2NiVoe gqzEp7xcgDWlfvS2a+/NENi9SLDV2i/4q7lpc6XjgtMb75W1ZwcKwTI8mdJ0k1aCZXg9Fp4uC6hI6 nj10NeHuhL6YZdEN61ddSwQdmROSfNP7KPWMta0t+l7ExQgZmZYw32Tx5/6sh+9YQfQdzNvlW6i5M bpdiamNgi/5f4hZTqQ8QQb83Qcq/xxZrJtVZh86PyriSORqjInSDccs8fjdKbiqo/0mz5EfllgmaD rTquyBURcDtxKOD7RwUA6RNG94HS+71a+6UT8g2eCDBDj4ngC4KAapfTdA97wzwJ9hexQVewdo3Yw kQmYfzIA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qMBeW-006LLw-9E; Wed, 19 Jul 2023 18:11:56 +0000 Date: Wed, 19 Jul 2023 19:11:56 +0100 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com Subject: Re: [PATCH] mm/hugetlb: get rid of page_hstate() Message-ID: References: <20230719175944.292929-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230719175944.292929-1-sidhartha.kumar@oracle.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Wed, Jul 19, 2023 at 10:59:44AM -0700, Sidhartha Kumar wrote: > - skip_pages = compound_nr(head) - (page - head); > + skip_pages = folio_nr_pages(folio) - (page - &folio->page); It turns out that you can't do (page - head) under all configs. It works on all common ones, but the safe way to do what you want here is: skip_pages = folio_nr_pages(folio) - folio_page_idx(folio, page);