Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp376772pxy; Wed, 5 May 2021 04:34:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUVtYCk4MI6lszxjqe+kOgqNAwLMkVgqfIFiDyZNddINb1sQ2vO5DRYgciIq79Kf01hh5X X-Received: by 2002:a17:90b:4a81:: with SMTP id lp1mr34233392pjb.226.1620214473202; Wed, 05 May 2021 04:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620214473; cv=none; d=google.com; s=arc-20160816; b=mxoaHaPbiy7S08y0bWAd25EoU4RAdcm7HGEfCiEey27hGHfMBIbyiA9UHloYPeNvO3 IZUw1Wj9A+qZ6IJhSKkQak+iUgHVfeTHMk2zs4eP26v7mw8t2WozIW5+ns5MmayqsIxG z8oGNy+rjLyzd/mxHQMkEaK08PuK2Dx1XrBhT4lfpKH76STrrTPnxz09OjvOApcGy7At JsQkcKDXmUfkYB7JFo6QBg+u42VzHyj6so7la1u+/UQGCNobqMaCY58xTR2/QC5GaoSq ddbTCPVcIJfvIScSDQETI2PcvDnb9b1H1lZ9PXNfdn+wRfHFlB6lLdP/1uwNC1lWWrJG w0QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=vebZxAVrGGsG4glJCxitkG4AqUJZKYsMR+3BGXq64bs=; b=zJP1VWd/a6VMvJnHbea5sl+A+SnwGEjEDIux5SO+4b58+veLFANneurF5gM8jdYL+F bsKcXUsR332qNVJE7rmuGq0+auA7dLSkLC6oOc+w9+NksFevyg2vy6/ArJuTr8HefsVf IlmxjbxTVxAWnPf1DlepOCABAYiLOC5ZB57V/T6wh79OkHVmSEiR4kdbhFbolXQELZnO gxXAIdvr2RpEOL9v7EtIoVWZySCrXrOn3Ld8lczedug2i4kw7Hw/LMVFXp039+6Wlw4o e7SakUiHfwDfkcdKGmLT5DKGDOG6Tkt+jp0DkDTO99rRvy7Io/bBI7lkA/7i/lT0SZTv 3BBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si6647338pjw.52.2021.05.05.04.34.19; Wed, 05 May 2021 04:34:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbhEELdL (ORCPT + 99 others); Wed, 5 May 2021 07:33:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:33976 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbhEELdK (ORCPT ); Wed, 5 May 2021 07:33:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A7EB6B2BE; Wed, 5 May 2021 11:32:13 +0000 (UTC) Subject: Re: [PATCH v2 1/2] mm: memcg/slab: Properly set up gfp flags for objcg pointer array To: Shakeel Butt , Waiman Long Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , LKML , Cgroups , Linux MM References: <20210504132350.4693-1-longman@redhat.com> <20210504132350.4693-2-longman@redhat.com> <267501a0-f416-4058-70d3-e32eeec3d6da@redhat.com> From: Vlastimil Babka Message-ID: Date: Wed, 5 May 2021 13:32:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/4/21 10:06 PM, Shakeel Butt wrote: > On Tue, May 4, 2021 at 1:02 PM Waiman Long wrote: >> >> On 5/4/21 3:37 PM, Shakeel Butt wrote: >> > On Tue, May 4, 2021 at 6:24 AM Waiman Long wrote: >> >> Since the merging of the new slab memory controller in v5.9, the page >> >> structure may store a pointer to obj_cgroup pointer array for slab pages. >> >> Currently, only the __GFP_ACCOUNT bit is masked off. However, the array >> >> is not readily reclaimable and doesn't need to come from the DMA buffer. >> >> So those GFP bits should be masked off as well. >> >> >> >> Do the flag bit clearing at memcg_alloc_page_obj_cgroups() to make sure >> >> that it is consistently applied no matter where it is called. >> >> >> >> Fixes: 286e04b8ed7a ("mm: memcg/slab: allocate obj_cgroups for non-root slab pages") >> >> Signed-off-by: Waiman Long >> >> --- >> >> mm/memcontrol.c | 8 ++++++++ >> >> mm/slab.h | 1 - >> >> 2 files changed, 8 insertions(+), 1 deletion(-) >> >> >> >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >> >> index c100265dc393..5e3b4f23b830 100644 >> >> --- a/mm/memcontrol.c >> >> +++ b/mm/memcontrol.c >> >> @@ -2863,6 +2863,13 @@ static struct mem_cgroup *get_mem_cgroup_from_objcg(struct obj_cgroup *objcg) >> >> } >> >> >> >> #ifdef CONFIG_MEMCG_KMEM >> >> +/* >> >> + * The allocated objcg pointers array is not accounted directly. >> >> + * Moreover, it should not come from DMA buffer and is not readily >> >> + * reclaimable. So those GFP bits should be masked off. >> >> + */ >> >> +#define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT) >> > What about __GFP_DMA32? Does it matter? It seems like DMA32 requests >> > go to normal caches. >> >> I included __GFP_DMA32 in my first draft patch. However, __GFP_DMA32 is >> not considered in determining the right kmalloc_type() (patch 2), so I >> took it out to make it consistent. I can certainly add it back. >> > > No this is fine and DMA32 question is unrelated to this patch series. We never supported them in kmalloc(), only explicit caches with SLAB_CACHE_DMA32 flag.