From patchwork Wed Mar 18 07:28:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srikar Dronamraju X-Patchwork-Id: 11444645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 613DF90 for ; Wed, 18 Mar 2020 07:28:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F01020768 for ; Wed, 18 Mar 2020 07:28:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F01020768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E7926B0007; Wed, 18 Mar 2020 03:28:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 598FD6B0008; Wed, 18 Mar 2020 03:28:39 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D7FB6B000A; Wed, 18 Mar 2020 03:28:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 366486B0007 for ; Wed, 18 Mar 2020 03:28:39 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0F5DC180AD81F for ; Wed, 18 Mar 2020 07:28:39 +0000 (UTC) X-FDA: 76607655558.30.slip65_4b74dae63a65b X-Spam-Summary: 2,0,0,24d32bef48b1d41b,d41d8cd98f00b204,srikar@linux.vnet.ibm.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1261:1345:1359:1431:1437:1535:1543:1711:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3867:3870:3871:4117:4321:4385:5007:6119:6261:6742:7875:7903:7904:8660:9592:10004:11026:11232:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13148:13221:13229:13230:13846:14096:14181:14394:14721:21080:21324:21451:21627:21990:30054,0,RBL:148.163.156.1:@linux.vnet.ibm.com:.lbl8.mailshell.net-64.201.201.201 62.8.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: slip65_4b74dae63a65b X-Filterd-Recvd-Size: 6869 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Mar 2020 07:28:38 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02I74Th3118792 for ; Wed, 18 Mar 2020 03:28:37 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yu8hv48qb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 18 Mar 2020 03:28:36 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Mar 2020 07:28:34 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 18 Mar 2020 07:28:29 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02I7SRu064749808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Mar 2020 07:28:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEB4E42042; Wed, 18 Mar 2020 07:28:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D4504203F; Wed, 18 Mar 2020 07:28:24 +0000 (GMT) Received: from srikart450.in.ibm.com (unknown [9.85.106.17]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 18 Mar 2020 07:28:23 +0000 (GMT) From: Srikar Dronamraju To: Andrew Morton Cc: Srikar Dronamraju , linux-mm@kvack.org, Mel Gorman , Michael Ellerman , Sachin Sant , Michal Hocko , Christopher Lameter , linuxppc-dev@lists.ozlabs.org, Joonsoo Kim , Kirill Tkhai , Vlastimil Babka , Bharata B Rao , Nathan Lynch Subject: [PATCH v2 2/4] mm/slub: Use mem_node to allocate a new slab Date: Wed, 18 Mar 2020 12:58:08 +0530 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318072810.9735-1-srikar@linux.vnet.ibm.com> References: <20200318072810.9735-1-srikar@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 20031807-0020-0000-0000-000003B65465 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20031807-0021-0000-0000-0000220EBC51 Message-Id: <20200318072810.9735-3-srikar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-18_02:2020-03-17,2020-03-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 suspectscore=0 mlxlogscore=962 priorityscore=1501 impostorscore=0 phishscore=0 clxscore=1015 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003180034 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: Currently while allocating a slab for a offline node, we use its associated node_numa_mem to search for a partial slab. If we don't find a partial slab, we try allocating a slab from the offline node using __alloc_pages_node. However this is bound to fail. NIP [c00000000039a300] __alloc_pages_nodemask+0x130/0x3b0 LR [c00000000039a3c4] __alloc_pages_nodemask+0x1f4/0x3b0 Call Trace: [c0000008b36837f0] [c00000000039a3b4] __alloc_pages_nodemask+0x1e4/0x3b0 (unreliable) [c0000008b3683870] [c0000000003d1ff8] new_slab+0x128/0xcf0 [c0000008b3683950] [c0000000003d6060] ___slab_alloc+0x410/0x820 [c0000008b3683a40] [c0000000003d64a4] __slab_alloc+0x34/0x60 [c0000008b3683a70] [c0000000003d78b0] __kmalloc_node+0x110/0x490 [c0000008b3683af0] [c000000000343a08] kvmalloc_node+0x58/0x110 [c0000008b3683b30] [c0000000003ffd44] mem_cgroup_css_online+0x104/0x270 [c0000008b3683b90] [c000000000234e08] online_css+0x48/0xd0 [c0000008b3683bc0] [c00000000023dedc] cgroup_apply_control_enable+0x2ec/0x4d0 [c0000008b3683ca0] [c0000000002416f8] cgroup_mkdir+0x228/0x5f0 [c0000008b3683d10] [c000000000520360] kernfs_iop_mkdir+0x90/0xf0 [c0000008b3683d50] [c00000000043e400] vfs_mkdir+0x110/0x230 [c0000008b3683da0] [c000000000441ee0] do_mkdirat+0xb0/0x1a0 [c0000008b3683e20] [c00000000000b278] system_call+0x5c/0x68 Mitigate this by allocating the new slab from the node_numa_mem. Cc: Andrew Morton Cc: linux-mm@kvack.org Cc: Mel Gorman Cc: Michael Ellerman Cc: Sachin Sant Cc: Michal Hocko Cc: Christopher Lameter Cc: linuxppc-dev@lists.ozlabs.org Cc: Joonsoo Kim Cc: Kirill Tkhai Cc: Vlastimil Babka Cc: Srikar Dronamraju Cc: Bharata B Rao Cc: Nathan Lynch Reported-by: Sachin Sant Tested-by: Sachin Sant Signed-off-by: Srikar Dronamraju --- Changelog v1 -> v2: - Handled comments from Vlastimil Babka - Now node gets set to node_numa_mem in new_slab_objects. mm/slub.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 1c55bf7892bf..2dc603a84290 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2475,6 +2475,9 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags, if (freelist) return freelist; + if (node != NUMA_NO_NODE && !node_present_pages(node)) + node = node_to_mem_node(node); + page = new_slab(s, flags, node); if (page) { c = raw_cpu_ptr(s->cpu_slab); @@ -2569,12 +2572,10 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, redo: if (unlikely(!node_match(page, node))) { - int searchnode = node; - if (node != NUMA_NO_NODE && !node_present_pages(node)) - searchnode = node_to_mem_node(node); + node = node_to_mem_node(node); - if (unlikely(!node_match(page, searchnode))) { + if (unlikely(!node_match(page, node))) { stat(s, ALLOC_NODE_MISMATCH); deactivate_slab(s, page, c->freelist, c); goto new_slab;