Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1615019ybh; Fri, 13 Mar 2020 04:28:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vswXUM75JN1X6aGCKXNk0lVJiBNcsBBqLdwgaKdR5Q/BVH7HZLReug3JB6hfx6GIuTU/j+a X-Received: by 2002:aca:b9d6:: with SMTP id j205mr6633807oif.179.1584098914693; Fri, 13 Mar 2020 04:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584098914; cv=none; d=google.com; s=arc-20160816; b=cBD82I+OzFI9B9AyXaSHlC1XVr3nI4ZMBicfXu0F1pU4G5CMLATQBF7RrYJ+Su8Wmg I3x2AbIWTLH4vGvzVqVT6PDSMPa/2wzOj1oIi+2zyDgWED6fpFxXA4g9sJOSNlAY88RT QMFz5YthzxtknLrX9hQcqf1dFLfIeTKn/6Jirl4pWxme/0SMPJwbuHy+dzlOtWY2LiX8 mV+aILEUi+kyF7ag6Hu6TGtL4XAqj67QvRRKuwV6KZUGON2DEgGCiVLAgUED/AnPlIu+ mTLdKD0ZgKpQ1tpJ9pMdwjJeHgrGEKzGlNKN4P63kFL5uWYnhBA3XGRAZQTt6oyFb4Md Jm5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=vj34fYNMbpK1pCgGlFpPhV60+zA9Q7RZZ0157fJ00jc=; b=n+e44BrgUiKnvLpvmNL40qj8rym6KY7QXRzVsDNYCaYaWdTK6/JFJHsn1CyKwhq5Tg Y7a77KOR/IDv7B0St045Rgkrd4azMXX2yK6p4PumBZi0pGaHzNn7pHSnQW0Rbofb8h/l VLvqdYoF7Sis3L9WkBHiTlVAV0s1O6N1kc2XQHBOUPb2sf2Eg1UL4hMlgDBDaQCG0j3v fr3KLnnn+jv4zIiq1noWh/FY6DcqgVckXEY7RcF4MlJAUVYeBSslj3zAMZryL2pTbtqh ACO1KZWP+nfobRgl2ZGHiOrxruVMn/ohP5RmCYY78Vpe27/CVGXv73cwDszXSGTDUN7n rVwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si4236658otr.97.2020.03.13.04.28.22; Fri, 13 Mar 2020 04:28:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgCML15 (ORCPT + 99 others); Fri, 13 Mar 2020 07:27:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64142 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726414AbgCML14 (ORCPT ); Fri, 13 Mar 2020 07:27:56 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02DBN8Zs063038 for ; Fri, 13 Mar 2020 07:27:55 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yr8kmhp62-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 Mar 2020 07:27:54 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Mar 2020 11:22:53 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 13 Mar 2020 11:22:48 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02DBMlsH43057466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Mar 2020 11:22:47 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BCD55205F; Fri, 13 Mar 2020 11:22:47 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by d06av21.portsmouth.uk.ibm.com (Postfix) with SMTP id B859E5204F; Fri, 13 Mar 2020 11:22:44 +0000 (GMT) Date: Fri, 13 Mar 2020 16:52:44 +0530 From: Srikar Dronamraju To: Vlastimil Babka Cc: Sachin Sant , Michal Hocko , Linus Torvalds , LKML , linux-mm@kvack.org, Mel Gorman , "Kirill A. Shutemov" , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Christopher Lameter , Joonsoo Kim , Kirill Tkhai Subject: Re: [PATCH 1/3] powerpc/numa: Set numa_node for all possible cpus Reply-To: Srikar Dronamraju References: <20200311110237.5731-1-srikar@linux.vnet.ibm.com> <20200311110237.5731-2-srikar@linux.vnet.ibm.com> <20200311115735.GM23944@dhcp22.suse.cz> <20200312052707.GA3277@linux.vnet.ibm.com> <5e5c736a-a88c-7c76-fc3d-7bc765e8dcba@suse.cz> <20200312131438.GB3277@linux.vnet.ibm.com> <61437352-8b54-38fa-4471-044a65c9d05a@suse.cz> <20200312161310.GC3277@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-TM-AS-GCONF: 00 x-cbid: 20031311-4275-0000-0000-000003ABA74A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20031311-4276-0000-0000-000038C0C8AB Message-Id: <20200313112244.GC25144@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-13_04:2020-03-12,2020-03-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003130057 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Vlastimil Babka [2020-03-12 17:41:58]: > On 3/12/20 5:13 PM, Srikar Dronamraju wrote: > > * Vlastimil Babka [2020-03-12 14:51:38]: > > > >> > * Vlastimil Babka [2020-03-12 10:30:50]: > >> > > >> >> On 3/12/20 9:23 AM, Sachin Sant wrote: > >> >> >> On 12-Mar-2020, at 10:57 AM, Srikar Dronamraju wrote: > >> >> >> * Michal Hocko [2020-03-11 12:57:35]: > >> >> >>> On Wed 11-03-20 16:32:35, Srikar Dronamraju wrote: > >> I think we do need well defined and documented rules around node_to_mem_node(), > >> cpu_to_node(), existence of NODE_DATA, various node_states bitmaps etc so > >> everyone handles it the same, safe way. > > So let's try to brainstorm how this would look like? What I mean are some rules > like below, even if some details in my current understanding are most likely > incorrect: > Agree. > with nid present in: > N_POSSIBLE - pgdat might not exist, node_to_mem_node() must return some online > node with memory so that we don't require everyone to search for it in slightly > different ways > N_ONLINE - pgdat must exist, there doesn't have to be present memory, > node_to_mem_node() still has to return something else (?) Right, think this has been taken care of at this time. > N_NORMAL_MEMORY - there is present memory, node_to_mem_node() returns itself > N_HIGH_MEMORY - node has present high memory > dont see any problems with the above two to. That leaves us with N_POSSIBLE. > > > > Other option would be to tweak Kirill Tkhai's patch such that we call > > kvmalloc_node()/kzalloc_node() if node is online and call kvmalloc/kvzalloc > > if the node is offline. > > I really would like a solution that hides these ugly details from callers so > they don't have to workaround the APIs we provide. kvmalloc_node() really > shouldn't crash, and it should fallback automatically if we don't give it > __GFP_THISNODE > Agree thats its better to make API's robust where possible. > However, taking a step back, memcg_alloc_shrinker_maps() is probably rather > wasteful on systems with 256 possible nodes and only few present, by allocating > effectively dead structures for each memcg. > If we dont allocate now, we would have to allocate them when we online the nodes. To me it looks better to allocate as soon as the nodes are onlined, > SLUB tries to be smart, so it allocates the per-node per-cache structures only > when the node goes online in slab_mem_going_online_callback(). This is why > there's a crash when such non-existing structures are accessed for a node that's > not online, and why they shouldn't be accessed. > > Perhaps memcg should do the same on-demand allocation, if possible. > Right. -- Thanks and Regards Srikar Dronamraju