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 08C57C433FE for ; Thu, 17 Nov 2022 01:39:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C78B6B0073; Wed, 16 Nov 2022 20:39:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 675656B0074; Wed, 16 Nov 2022 20:39:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 564AC6B0075; Wed, 16 Nov 2022 20:39:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 466F66B0073 for ; Wed, 16 Nov 2022 20:39:24 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 13248C04A2 for ; Thu, 17 Nov 2022 01:39:24 +0000 (UTC) X-FDA: 80141226648.27.D5D4CC3 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf08.hostedemail.com (Postfix) with ESMTP id B7A4B160008 for ; Thu, 17 Nov 2022 01:39:23 +0000 (UTC) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-382f0906929so5118697b3.10 for ; Wed, 16 Nov 2022 17:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=q+zGv9vaFR5Pk6w8irqXhv3za0LaNRRJC/xfq3ObajE=; b=KcE2WeaXge1v3PX1H634l/+DCU4lr6UaJt1yg2rv61+dta0Nz72nTz1mszYBBqfsME tF38kGGo26RzzAtS3ujs5cNMHsbwzkN6gZhBjFiHjSjz6WWWz/ZhlrlgnEueKNKlFqJ2 GtI6Dw4DJ6tFsVEn5eQiZGMLr/qSs1r2oKBkkt/NG9IJ/Zt+ExHdhujT08YrLI0OLCdB 5q91HrNzYsY3nICH3PRvmKjgR2+Acb0BZBA893yXGrIXt2/P1Ce4JksfNh4R3MIsPiP8 GueHEO4ZsWo/Tv0iAaWZCnWFyyNumdcmONg/GOUzKLPWPVD3gKNUEJ7vqvilZtkhmpX3 z7og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q+zGv9vaFR5Pk6w8irqXhv3za0LaNRRJC/xfq3ObajE=; b=kbuLtt5k+7vDlakaVyDFm/hv+2q1F4K1ZiiVP0rOTlet8g59C8rlnKBas01QwsWSpp O/z4bGwaZuGGmt2DmoofmOHBvbxRZ6hszl3w4v2zbZGknF8Uqen0whe3/23Gsig8ujty s8IbPFO8WKO0VKm5fdlN7SAjJ45P7nTh/HeXE/rgqqieMiX4t0u4gX1CWACBB8oeY3Sz 2okjzbcVARvDTd191111w/Ijxwi47tqMQHnhzeW+Cp1v7QvmEI+bSl8ADvrccZDaK3Nr hUGrtG5k/e3Fty6jaoYaOMu8xmVEctTf3CjY6VuMPiIU4XX/RWnkzJccif+Wttvh1p0T UlGQ== X-Gm-Message-State: ANoB5pm9gua86FKEi9T9P+qlgBl8ns2e6Laq9BS5i+qTM0fHwTVEMZuz jK/t1gunPyPgbT4q1ptWkMX7exIrHhuObuOd2ZDBZw== X-Google-Smtp-Source: AA0mqf5hwszcJje10Ni1qfeUIno07FzJfKvsq9PsVi2yjGB8A2lel1WPcRdV+av6m+aC5pj1toVSWtYf5LJKGkzBwh4= X-Received: by 2002:a81:8302:0:b0:36a:1b76:eca8 with SMTP id t2-20020a818302000000b0036a1b76eca8mr94333ywf.483.1668649162897; Wed, 16 Nov 2022 17:39:22 -0800 (PST) MIME-Version: 1.0 References: <20221021163703.3218176-1-jthoughton@google.com> <20221021163703.3218176-13-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Wed, 16 Nov 2022 17:39:12 -0800 Message-ID: Subject: Re: [RFC PATCH v2 12/47] hugetlb: add hugetlb_hgm_walk and hugetlb_walk_step To: Peter Xu Cc: Mike Kravetz , Muchun Song , David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668649163; a=rsa-sha256; cv=none; b=YHboEHuenVBaQ0YjWzMvvLpUSXmPtIxAfemyOTrjNTvCvwP23C7iEAHVzfpGR3otHjDO1g Y9L69P9jixw/Mn1W6FEzf0hLfWIXC+ukK4RZkJG3a178BGYH/C2D40t22xGsl6oxXTa3D7 Gtb0O/J3olxiuWZZrGHn+ir+S1mwIZw= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KcE2WeaX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of jthoughton@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=jthoughton@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668649163; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q+zGv9vaFR5Pk6w8irqXhv3za0LaNRRJC/xfq3ObajE=; b=R/lsI8l2Ae624thtsehG5Mm7BE6f2ymBD2KIxMw7/UaeqNrzE0wuz3t/q8hFLA1BusJ778 WP63BcsUmuO7ylTQ8McLMl5VGYwI56BPyAwJT1+ycFKvhHqWKGdMKMHegHfG4vCZDRkdEb se5660U2eB9LGAjTGHA3CPSMTbzPj48= X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B7A4B160008 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=KcE2WeaX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf08.hostedemail.com: domain of jthoughton@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=jthoughton@google.com X-Stat-Signature: c5rhnijei3j95cucmyrsw5fgtyn6erw3 X-HE-Tag: 1668649163-87758 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: On Wed, Nov 16, 2022 at 2:02 PM Peter Xu wrote: > > On Fri, Oct 21, 2022 at 04:36:28PM +0000, James Houghton wrote: > > +/* hugetlb_hgm_walk - walks a high-granularity HugeTLB page table to resolve > > + * the page table entry for @addr. > > + * > > + * @hpte must always be pointing at an hstate-level PTE (or deeper). > > + * > > + * This function will never walk further if it encounters a PTE of a size > > + * less than or equal to @sz. > > + * > > + * @stop_at_none determines what we do when we encounter an empty PTE. > > IIUC it is not about empty PTE but swap-or-empty pte? > > I'm not sure whether it'll be more straightforward to have "bool alloc" > just to show whether the caller would like to allocate pgtables when > walking the sub-level pgtable until the level specified. I think "bool alloc" is cleaner. I'll do that. Thanks for the suggestion. > > In final version of the code I also think we should drop all the "/* > stop_at_pte */" comments in the callers. Maybe that already means the > meaning of the bool is confusing so we always need a hint. I did that to hopefully make things easier to read. I'll remove it. - James > > -- > Peter Xu >