From: ran xiaokai <ranxiaokai627@163.com>
To: david@redhat.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, mhocko@kernel.org, ran.xiaokai@zte.com.cn,
ranxiaokai627@163.com, v-songbaohua@oppo.com,
xu.xin16@zte.com.cn, yang.yang29@zte.com.cn, ziy@nvidia.com
Subject: Re: [PATCH linux-next] mm: huge_memory: fix misused mapping_large_folio_support() for anon folios
Date: Wed, 5 Jun 2024 08:30:08 +0000 [thread overview]
Message-ID: <20240605083008.891170-1-ranxiaokai627@163.com> (raw)
In-Reply-To: <05e50d0c-4222-4c1f-b051-c7249f04c661@redhat.com>
> On 05.06.24 04:20, ran xiaokai wrote:
> >> On 04.06.24 07:47, xu.xin16@zte.com.cn wrote:
> >>> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> >>>
> >>> When I did a large folios split test, a WARNING
> >>> "[ 5059.122759][ T166] Cannot split file folio to non-0 order"
> >>> was triggered. But my test cases are only for anonmous folios.
> >>> while mapping_large_folio_support() is only reasonable for page
> >>> cache folios.
> >>
> >> Agreed.
> >>
> >> I wonder if mapping_large_folio_support() should either
> >>
> >> a) Complain if used for anon folios, so we can detect the wrong use more
> >> easily. (VM_WARN_ON_ONCE())
> >
> >> b) Return "true" for anonymous mappings, although that's more debatable.
> >>
> >
> > Hi, David,
> > Thanks for the review.
> > I think a) is better.
> > But we have to add a new parameter "folio" to mapping_large_folio_support(), right ?
> > something like mapping_large_folio_support(struct address_space *mapping, struct folio *folio) ?
> > But in the __filemap_get_folio() path,
> >
> > __filemap_get_folio()
> > no_page:
> > ....
> > if (!mapping_large_folio_support(mapping))
> >
> > the folio is not allocated yet, yes ?
> > Or do you mean there is some other way to do this ?
>
> If we really pass unmodified folio->mapping, you can do what
> folio_test_anon() would and make sure PAGE_MAPPING_ANON is not set.
I think I just misunderstood your suggestion.
How about this ?
static inline bool mapping_large_folio_support(struct address_space *mapping)
{
VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON,
"Anonymous mapping always supports large folio");
return IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
test_bit(AS_LARGE_FOLIO_SUPPORT, &mapping->flags);
}
next prev parent reply other threads:[~2024-06-05 8:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 5:47 xu.xin16
2024-06-04 7:57 ` David Hildenbrand
2024-06-04 13:52 ` Zi Yan
2024-06-04 13:57 ` Zi Yan
2024-06-05 2:56 ` ran xiaokai
2024-06-05 2:20 ` ran xiaokai
2024-06-05 7:25 ` David Hildenbrand
2024-06-05 8:30 ` ran xiaokai [this message]
2024-06-05 8:33 ` David Hildenbrand
2024-06-05 9:06 ` Barry Song
[not found] ` <20240605095406.891512-1-ranxiaokai627@163.com>
2024-06-05 14:08 ` Zi Yan
[not found] ` <c110eb46-3c9d-40c3-ab16-5bd9f75b6501@redhat.com>
2024-06-06 1:34 ` Barry Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240605083008.891170-1-ranxiaokai627@163.com \
--to=ranxiaokai627@163.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=v-songbaohua@oppo.com \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox