Re: [PATCH -next v2 2/7] mm: damon: introduce damon_get_folio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Dec 2022 19:49:56 +0000 Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:

> On Tue, Dec 27, 2022 at 07:42:57PM +0000, SeongJae Park wrote:
> > > +static inline struct page *damon_get_page(unsigned long pfn)
> > > +{
> > > +	struct folio *folio = damon_get_folio(pfn);
> > > +
> > > +	return &folio->page;
> > 
> > I think we should check if folio is NULL before dereferencing it?
> 
> &folio->page does not dereeference folio.

Ah, ok.  And this is safe because ->page is at the beginning of folio, right?

Kefeng, could we add a comment explaining it, for people having bad eyes like
me?


Thanks,
SJ




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux