Re: [PATCH 4/5] mm: Simplify folio_memcg_charged()

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

 



On Thu, Mar 13, 2025 at 04:15:38PM +0000, Matthew Wilcox wrote:
> On Thu, Mar 13, 2025 at 12:03:48PM -0400, Johannes Weiner wrote:
> > >  static inline bool folio_memcg_charged(struct folio *folio)
> > >  {
> > > -	if (folio_memcg_kmem(folio))
> > > -		return __folio_objcg(folio) != NULL;
> > > -	return __folio_memcg(folio) != NULL;
> > > +	return folio->memcg_data != 0;
> > 
> > I suppose we lose a few DEBUG_VM asserts, but no doubt this function
> > is unnecessarily complicated.
> 
> I think we lose two -- folio_test_slab() and
> memcg_data & MEMCG_DATA_OBJEXTS, both of which seem pretty low value.
> Also, one could argue that asking "is this memory charged" should
> return true if we ask it about a slab.  So yeah, I didn't think they
> were worth preserving.
> 

With separete struct slab, no one should be calling folio_memcg_charged()
with it, so I think these asserts were unnecessary.

> 




[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