Re: [PATCH-next] mm, memcg: Add ":deact" tag for reparented kmem caches in memcg_slabinfo

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

 



On 6/26/19 3:58 PM, Roman Gushchin wrote:
> On Fri, Jun 21, 2019 at 01:30:05PM -0400, Waiman Long wrote:
>> With Roman's kmem cache reparent patch, multiple kmem caches of the same
>> type can be seen attached to the same memcg id. All of them, except
>> maybe one, are reparent'ed kmem caches. It can be useful to tag those
>> reparented caches by adding a new slab flag "SLAB_DEACTIVATED" to those
>> kmem caches that will be reparent'ed if it cannot be destroyed completely.
>>
>> For the reparent'ed memcg kmem caches, the tag ":deact" will now be
>> shown in <debugfs>/memcg_slabinfo.
>>
>> Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
> Hi Waiman!
>
> Sorry for the late reply. The patch overall looks good to me,
> except one nit. Please feel free to use my ack:
> Acked-by: Roman Gushchin <guro@xxxxxx>
>
>> ---
>>  include/linux/slab.h |  4 ++++
>>  mm/slab.c            |  1 +
>>  mm/slab_common.c     | 14 ++++++++------
>>  mm/slub.c            |  1 +
>>  4 files changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/linux/slab.h b/include/linux/slab.h
>> index fecf40b7be69..19ab1380f875 100644
>> --- a/include/linux/slab.h
>> +++ b/include/linux/slab.h
>> @@ -116,6 +116,10 @@
>>  /* Objects are reclaimable */
>>  #define SLAB_RECLAIM_ACCOUNT	((slab_flags_t __force)0x00020000U)
>>  #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
>> +
>> +/* Slab deactivation flag */
>> +#define SLAB_DEACTIVATED	((slab_flags_t __force)0x10000000U)
>> +
>>  /*
>>   * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
>>   *
>> diff --git a/mm/slab.c b/mm/slab.c
>> index a2e93adf1df0..e8c7743fc283 100644
>> --- a/mm/slab.c
>> +++ b/mm/slab.c
>> @@ -2245,6 +2245,7 @@ int __kmem_cache_shrink(struct kmem_cache *cachep)
>>  #ifdef CONFIG_MEMCG
>>  void __kmemcg_cache_deactivate(struct kmem_cache *cachep)
>>  {
>> +	cachep->flags |= SLAB_DEACTIVATED;
> A nit: it can be done from kmemcg_cache_deactivate() instead,
> and then you don't have to do it in slab and slub separately.
>
> Since it's not slab- or slub-specific code, it'd be better, IMO,
> to put it into slab_common.c.

Thanks for the suggestion.

You are right. It will be cleaner to set the flag in
kmemcg_cache_deactivate(). I have just sent out a v2 patch to do that.

Cheers,
Longman




[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