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 47D81CDB46E for ; Thu, 12 Oct 2023 15:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF7078D00FC; Thu, 12 Oct 2023 11:30:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA61A8D0002; Thu, 12 Oct 2023 11:30:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A46F18D00FC; Thu, 12 Oct 2023 11:30:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 904968D0002 for ; Thu, 12 Oct 2023 11:30:43 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1A122A06D9 for ; Thu, 12 Oct 2023 15:30:43 +0000 (UTC) X-FDA: 81337196766.02.4EA4F0F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id E79148001F for ; Thu, 12 Oct 2023 15:30:39 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M+9OQl0X; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697124640; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zFdUa2CPCu3i7sYwk8S5CwMezdoReJ8iWYq2uB+Ck3s=; b=lXyndoc0ZGTmO3dqtRH+XyXOFDnLxEhQ9h9f0BwkJexmd/TOOP0YPzvY9rvHoYbLZxN4EP Acsav1boMjCvtCcSDVC8tMsHt+8zFwdWGI91kiKlhJcIHLHvPqSUVjohGO1jfxLoy7tb8x xjaY2JQ+qwRgDtxyKEIgOFuCUwnvN8M= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M+9OQl0X; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697124640; a=rsa-sha256; cv=none; b=yoazxcQ5kDRrXkxPt3fsutOT9/DYH/mNhpMEdlg8++mGVI1gijYrHhiVbJH7HmZLjqhpCq RVL+Xy/cGyYV+fVwVUsucZ7iwqRqu6TLO8XZhuiMEVafrRf0SHuNUhybOa/l/UZIgDluyX Kwg7Gb78GKjxja+YYX8WxU86g0B4E/M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697124639; 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=M+9OQl0XpzwHibSJfE/2NYp/fwMun9cBvag5j96IBgdXzaQCgRHhg+yLa5zUNbhJQ+9FGh lUIPD1odOjvgZp2Zme1aL7GeXH0CehsaN8LYt98ORKwzBJ6vFVvaE6/i58RjtSAr+nzWJp UeHWZKXUcOq/Z3HhckECV5d8zM8Lu00= 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-630-eWB8x_84MTuayb60XVfAtg-1; Thu, 12 Oct 2023 11:30:37 -0400 X-MC-Unique: eWB8x_84MTuayb60XVfAtg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4053d832d51so7537065e9.0 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=gBbyxO2eV1KDPO+MMXFEhRG7Ez8ArFUv5pamZkq2dQ7z+aOfsdGlLMPSKCNNdfXuXX 0aTDvgeiPzFl7EtTGGGLCv4c7wn/i59TuF7FfepEpogdbvsZj0cE4OuZ4dlTKGSatsJb EWKWGnAKp1i3BWT4O3UfijXGejQ3/4Q3FBQAx5WMn/yP5HqTIROOA79C89QHVOombRb+ DkgfgPrwMR3FkIIZL/CTWDVvq1gjmIK/EOzG3Prhhl2g0TPYqnMh3xiS5mtTsCxDOE/Q Tdp/9rqv2NIuFkSFkpn4my8jgCbspR6+zvLba7/yckqvf4nrL9yBQ/ENgLL1EAsof4YZ bulQ== X-Gm-Message-State: AOJu0Yy5lTOrGlBXHN0fmCdzyBZSC2xnZZTK24k0zp0iE1iGMwmAp/wR +NpXOD0jMeLJNon/tQPxib/nK5CLZ5JxxHsM0lCx2imITGZ3wTLQNwEjTgAwx15v+z0gggTO90q fshx8Ka6A97c= X-Received: by 2002:a7b:c3d2:0:b0:405:75f0:fd31 with SMTP id t18-20020a7bc3d2000000b0040575f0fd31mr20064790wmj.31.1697124636151; Thu, 12 Oct 2023 08:30:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtJtQTMnQG+Tsh4UL3W3AKqxit8Jw3iKnOAMoNj4iNXQxpEZQFCuOeLvDRfbf79nwAtAIy0w== 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 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> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E79148001F X-Stat-Signature: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FHBRDtS0nvDOVD5K4Hzp2oNz4+jnKS5nwdnFVNCQdKotyrI9O61bfyWYfmqQu9AHHgGGYfddrQjRM8UFBRqbB/ULYG5H/B0hF4f3gE+WxTHg0MATYt0HljbI7jooq1bV9Te3CVgx3I9TqAdJWWLz4RCWQYNZSpyinv5anYRVvXHalvvZyyTfC82IYTvis1dPuLiG2i+CvJhV1mkPD9+a02dyLQm3pgU/Eb4IkBbX+QY/mTxnw3LQBlxYH5NH4O4qwL1mc9YQe2kRQTrX1djxbDmaS7ur5Lyf9YWfvAJLt73b8CSqlo25pPNYKe0PyQxsGRrHSFeyJUHYV+waCJ80rkg3DK3S2RwzyUfzHKUpCa7imx93m2rfQpLl2T4gbhW+fwrPqpDYQ+34bvm3OeEl5eECH9uU0gLNVGsG12gww22AbkhvXKKSE1sXjk/KEZBkY+o+EZlcqSC/lSqYP7vO4yJYmOtI0oUHAgCuXE7MQUJWT/n1Ya7G 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 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