lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240605083008.891170-1-ranxiaokai627@163.com>
Date: Wed,  5 Jun 2024 08:30:08 +0000
From: ran xiaokai <ranxiaokai627@....com>
To: david@...hat.com
Cc: akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	mhocko@...nel.org,
	ran.xiaokai@....com.cn,
	ranxiaokai627@....com,
	v-songbaohua@...o.com,
	xu.xin16@....com.cn,
	yang.yang29@....com.cn,
	ziy@...dia.com
Subject: Re: [PATCH linux-next] mm: huge_memory: fix misused mapping_large_folio_support() for anon folios

> On 05.06.24 04:20, ran xiaokai wrote:
> >> On 04.06.24 07:47, xu.xin16@....com.cn wrote:
> >>> From: Ran Xiaokai <ran.xiaokai@....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);
}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ