Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp390719rdg; Thu, 12 Oct 2023 08:31:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVPA10AT5nkvCkybiVIfHRnNgPDot6TcX/cQBMZI38cLKMvMyDj6nnpRq0jEYhUwSTRvkS X-Received: by 2002:aa7:8894:0:b0:68f:edfd:2ac6 with SMTP id z20-20020aa78894000000b0068fedfd2ac6mr28378224pfe.0.1697124699067; Thu, 12 Oct 2023 08:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697124699; cv=none; d=google.com; s=arc-20160816; b=n7TL1KNOVVosjKDd7FMF8cRsKWKkp//dGL3/D22rNB7oK0Am62MjvTU1HCoYA19Yju +oj7KUpScam/6laK8ucWymKygQVTRZKavXPhac4yeuiJw6myk4+z3NoNuD3sjEyxZb3p m+qfe8mKjcxOVnP28Xp6MUmN4qJYJjf5Ja+gMU1imn+QXSP+F+M5RWBI1/O8VW5muarn XlYR5IQEMmYjfjyFjDlcHU5wrrqgTJMtpvc8XAjhtnSLBbx/zeV8La71mdf+zvKLWyZx wy6A2qJEuZ7XsXOwn7yhQrwQjrA8uxHDmiLF1eTWIN4S6TQ2rxP0rDA7WEPwFxXNuh9F q7/A== 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:subject :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=zFdUa2CPCu3i7sYwk8S5CwMezdoReJ8iWYq2uB+Ck3s=; fh=2UoBQDB/9n8RG7shcQrG02xQU1gUU6Dx65V3BB25sZo=; b=La8Fang9XjI8b0ClMZFqkwfbjvwdCT8cxm28Onr3IuiOeVxDIe/6C0uMpdovhLpYgW DgC9vj8y3YUnHTc/fdlxucC5YZlWjSUPC6Y/j+SOIC2cgzYGEO3MAHteBUaP1+8iBZBC dZ7kLoOdFR18OoDrc78rHedFeSH5qXj82/UbL7LmEg70FzU9TEW8NrbVRSViTewZytPm bj8T7jRBF7uFKW30jUMiBEStxarESe5CckoPv7aCKPZ8hQw00Js+VigRXworIGyI43tF uFB3QoRcV09KHhJTXWI00ev56gPV7uDawt/B9qNwfArboy0Ays88R8kCIBMLxmY2vmAe Jxlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NkGUI6kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id cw16-20020a056a00451000b0068fa9821905si14678884pfb.335.2023.10.12.08.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 08:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NkGUI6kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id EB8A3808291E; Thu, 12 Oct 2023 08:31:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343696AbjJLPbT (ORCPT + 99 others); Thu, 12 Oct 2023 11:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235697AbjJLPbR (ORCPT ); Thu, 12 Oct 2023 11:31:17 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30D2BE for ; Thu, 12 Oct 2023 08:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697124638; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zFdUa2CPCu3i7sYwk8S5CwMezdoReJ8iWYq2uB+Ck3s=; b=NkGUI6kA1RHeH3/0xehleX7Qw70dyhhf+GARfm7q7J+WT1LnYFgGt8WfBaR2W+uAyok80s 9b7Rn23ohbcfv4I0dDjUflm9YTLF9k0IHa/C5UcsuJGPjODnuB3RXOrQa+OAZ3v6tG9qji fg7FZUfGYO1Vt8sE41zTVHXd0iAU6LM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-Ki_0HSg2ODCi6M3MCAwg7w-1; Thu, 12 Oct 2023 11:30:37 -0400 X-MC-Unique: Ki_0HSg2ODCi6M3MCAwg7w-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4065d52a83aso7480085e9.1 for ; Thu, 12 Oct 2023 08:30:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697124636; x=1697729436; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zFdUa2CPCu3i7sYwk8S5CwMezdoReJ8iWYq2uB+Ck3s=; b=d1FDyvHLBVqcFDYS8sw8f5ES9NLJ6IBSqRh4y7kdv3Siz+t/jOH/8G9ozT0etOdB+O wrV9VFfCWJFCvEev+rVWDFRb07niVJGscz2Rx26IenFl85TFREM8+SQyYcIM7Wn++Dxf 08PNoUzatB+WlYKKklR98MavFtdQIHra/J0V2V36RrPuPZoLVcukGLo72Yi4bDFDNvhT PZZNlZy/yH32hrpXm+ibFGr5Dun1HYh4KT9+o645soiV20D+rfZcI8yFpvGO5Xfb55dd eTVpQlFa8NpV6XqFXSZ9S2cPXvUIt8T/VweccCnaH2MEF9FFQHkm861/RMDdIL9jORPU bI+A== X-Gm-Message-State: AOJu0YwQkmZ9OHQP6ma+JNhblUeiuIubrU8hvDo94HSuRX6z+5IfREWf 7M3RCAH2EVb9HiO/k/p+/Z2P1nMZQFZyYKWbVuRjkJpE8mLcY6Kcp7HhcI4BCSmzzmmnRcqRKRZ 47FaQENQU2jgcUcvIAdguy/gE X-Received: by 2002:a7b:c3d2:0:b0:405:75f0:fd31 with SMTP id t18-20020a7bc3d2000000b0040575f0fd31mr20064794wmj.31.1697124636156; Thu, 12 Oct 2023 08:30:36 -0700 (PDT) X-Received: by 2002:a7b:c3d2:0:b0:405:75f0:fd31 with SMTP id t18-20020a7bc3d2000000b0040575f0fd31mr20064764wmj.31.1697124635646; Thu, 12 Oct 2023 08:30:35 -0700 (PDT) Received: from ?IPV6:2003:cb:c70d:ee00:b271:fb6c:a931:4769? (p200300cbc70dee00b271fb6ca9314769.dip0.t-ipconnect.de. [2003:cb:c70d:ee00:b271:fb6c:a931:4769]) by smtp.gmail.com with ESMTPSA id t14-20020a1c770e000000b004067e905f44sm141868wmi.9.2023.10.12.08.30.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 08:30:35 -0700 (PDT) Message-ID: <86170ebf-cbe3-1cda-dcb4-87e18695f9cd@redhat.com> Date: Thu, 12 Oct 2023 17:30:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Content-Language: en-US To: Naoya Horiguchi Cc: linux-mm@kvack.org, Andrew Morton , Matthew Wilcox , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> <63d119f7-5adb-861a-00c2-69a92b19ef9b@redhat.com> <20231012150226.GA473412@u2004> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1 0/5] mm, kpageflags: support folio and fix output for compound pages In-Reply-To: <20231012150226.GA473412@u2004> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 12 Oct 2023 08:31:31 -0700 (PDT) On 12.10.23 17:02, Naoya Horiguchi wrote: > On Thu, Oct 12, 2023 at 10:33:04AM +0200, David Hildenbrand wrote: >> On 10.10.23 16:27, Naoya Horiguchi wrote: >>> Hi everyone, >>> >>> This patchset addresses 2 issues in /proc/kpageflags. >>> >>> 1. We can't easily tell folio from thp, because currently both pages are >>> judged as thp, and >>> 2. we see some garbage data in records of compound tail pages because >>> we use tail pages to store some internal data. >>> >>> These issues require userspace programs to do additional work to understand >>> the page status, which makes situation more complicated. >>> >>> This patchset tries to solve these by defining KPF_FOLIO for issue 1., and >>> by hiding part of page flag info on tail pages of compound pages for issue 2. >>> >>> I think that technically some compound pages like thp/hugetlb/slab could be >>> considered as folio, but in this version KPF_FOLIO is set only on folios >> >> At least thp+hugetlb are most certainly folios. Regarding slab, I suspect we >> no longer call them folios (cannot be mapped to user space). But Im not sure >> about the type hierarchy. > > I'm not sure about the exact definition of "folio", and I think it's better > to make KPF_FOLIO set based on the definition. Me neither. But in any case a THP *is* a folio. So you'd have to set that flag in any case. And any order-0 page (i.e., anon, pagecache) is also a folio. What you seem to imply with folio is "large folio". So KPF_FOLIO is really wrong as far as I can tell. > "being mapped to userspace" can be one possible criteria for the definition. > But reading source code, folio_slab() and slab_folio() convert between > struct slab and struct folio, so I feel that someone might think a slab is > a kind of folio. I keep forgetting if "folio" is just the generic term for any order-0 or compound page, or only for some of them. I usually live in the "anon" world, so I don't get reminded that often :) >>> in pagecache (so "folios in narrower meaning"). I'm not confident about >>> this choice, so if you have any idea about this, please let me know. >> >> It does sound inconsistent. What exactly do you want to tell user space with >> the new flag? > > The current most problematic behavior is to report folio as thp (order-2 > pagecache page is definitely a folio but not a thp), and this is what the > new flag is intended to tell. We are currently considering calling these sub-PMD sized THPs "small-sized THP". [1] Arguably, we're starting with the anon part where we won't get around exposing them to the user in sysfs. So I wouldn't immediately say that these things are not THPs. They are not PMD-sized THP. A slab/hugetlb is certainly not a thp but a folio. Whereby slabs can also be order-0 folios, but hugetlb can't. Looking at other interfaces, we do expose: include/uapi/linux/kernel-page-flags.h:#define KPF_COMPOUND_HEAD 15 include/uapi/linux/kernel-page-flags.h:#define KPF_COMPOUND_TAIL 16 So maybe we should just continue talking about compound pages or do we have to use both terms here in this interface? [1] https://lkml.kernel.org/r/20230929114421.3761121-1-ryan.roberts@arm.com -- Cheers, David / dhildenb