linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Query on mm/folio-compat: pagecache_get_page
@ 2023-02-14 18:23 Deepak R Varma
  2023-02-14 18:35 ` Sidhartha Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak R Varma @ 2023-02-14 18:23 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel, willy
  Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma

Hello,
Could someone comment if it is safe to access the page member variable as
written on line #100 when folio is NULL as returned from the
__filemap_get_folio() function call? Is this kind of intentional page-fault
trigger for the system to handle a new/fresh page allocation?

	  2         folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
	  1         if (!folio || xa_is_value(folio))
	100                 return &folio->page;
	  1         return folio_file_page(folio, index);

The code is part of commit ID c5255b421fd04

Thank you,
./drv




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query on mm/folio-compat: pagecache_get_page
  2023-02-14 18:23 Query on mm/folio-compat: pagecache_get_page Deepak R Varma
@ 2023-02-14 18:35 ` Sidhartha Kumar
  2023-02-14 19:17   ` Deepak R Varma
  0 siblings, 1 reply; 3+ messages in thread
From: Sidhartha Kumar @ 2023-02-14 18:35 UTC (permalink / raw)
  To: Deepak R Varma, Andrew Morton, linux-mm, linux-kernel, willy
  Cc: Saurabh Singh Sengar, Praveen Kumar

On 2/14/23 10:23 AM, Deepak R Varma wrote:
> Hello,
> Could someone comment if it is safe to access the page member variable as
> written on line #100 when folio is NULL as returned from the

It is safe to access the page member variable when folio is NULL because 
the offset of page within struct folio is 0.[1]


[1] https://lore.kernel.org/lkml/Y7h4jsv6jl0XSIsk@casper.infradead.org/T/

Thanks,
Sidhartha Kumar

> __filemap_get_folio() function call? Is this kind of intentional page-fault
> trigger for the system to handle a new/fresh page allocation?
> 
> 	  2         folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
> 	  1         if (!folio || xa_is_value(folio))
> 	100                 return &folio->page;
> 	  1         return folio_file_page(folio, index);
> 
> The code is part of commit ID c5255b421fd04
> 
> Thank you,
> ./drv
> 
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Query on mm/folio-compat: pagecache_get_page
  2023-02-14 18:35 ` Sidhartha Kumar
@ 2023-02-14 19:17   ` Deepak R Varma
  0 siblings, 0 replies; 3+ messages in thread
From: Deepak R Varma @ 2023-02-14 19:17 UTC (permalink / raw)
  To: Sidhartha Kumar
  Cc: Andrew Morton, linux-mm, linux-kernel, willy,
	Saurabh Singh Sengar, Praveen Kumar

On Tue, Feb 14, 2023 at 10:35:33AM -0800, Sidhartha Kumar wrote:
> On 2/14/23 10:23 AM, Deepak R Varma wrote:
> > Hello,
> > Could someone comment if it is safe to access the page member variable as
> > written on line #100 when folio is NULL as returned from the
> 
> It is safe to access the page member variable when folio is NULL because the
> offset of page within struct folio is 0.[1]

Wow. This is so well thought. Thank you Sidhartha.

./drv

> 
> 
> [1] https://lore.kernel.org/lkml/Y7h4jsv6jl0XSIsk@casper.infradead.org/T/
> 
> Thanks,
> Sidhartha Kumar
> 
> > __filemap_get_folio() function call? Is this kind of intentional page-fault
> > trigger for the system to handle a new/fresh page allocation?
> > 
> > 	  2         folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
> > 	  1         if (!folio || xa_is_value(folio))
> > 	100                 return &folio->page;
> > 	  1         return folio_file_page(folio, index);
> > 
> > The code is part of commit ID c5255b421fd04
> > 
> > Thank you,
> > ./drv
> > 
> > 
> > 
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-14 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 18:23 Query on mm/folio-compat: pagecache_get_page Deepak R Varma
2023-02-14 18:35 ` Sidhartha Kumar
2023-02-14 19:17   ` Deepak R Varma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).