From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C441C433B4 for ; Wed, 5 May 2021 11:32:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5ED761176 for ; Wed, 5 May 2021 11:32:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5ED761176 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 006466B0070; Wed, 5 May 2021 07:32:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF8416B0071; Wed, 5 May 2021 07:32:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5E166B0072; Wed, 5 May 2021 07:32:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id B7D106B0070 for ; Wed, 5 May 2021 07:32:15 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 61D3D988D for ; Wed, 5 May 2021 11:32:15 +0000 (UTC) X-FDA: 78106963830.17.108B368 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP id 91EEBC0007E8 for ; Wed, 5 May 2021 11:31:54 +0000 (UTC) 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 Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf14.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: p68nr3qftu6g91ci7szoyqn8dptomi3n X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 91EEBC0007E8 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1620214314-716926 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.