Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3347155imm; Sun, 1 Jul 2018 19:17:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd17SabyWZQPAIZQJhmpAk2+HTsb37XLB2FlfX97NqMiNcMCm1uP5gvgPYcd+a9Pjx/2e4c X-Received: by 2002:a17:902:654b:: with SMTP id d11-v6mr16768781pln.8.1530497866938; Sun, 01 Jul 2018 19:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530497866; cv=none; d=google.com; s=arc-20160816; b=EFnNbokEh9FzamezXYSpPuNXjhWDLXTMe+iZGPwBjJE15/Qtsz31+tBH81pvPURHgK ykq/vqQFcB7N99gQdyw4+M2aKatKo501f5FMYceXoaod6BYOn1Tqfh/HOUbRRDn6cEE7 yacuAW11NUG/FelLTCWDnKTaT5LHTRAoxCzfXyLyZkCDYy3jqidVpbumTTmwo+R/pXVE kpGlPzyal2mAIKMSOkz4cN99xA1ftF99jJQygEiAwF1h+Jn0SDCN+WHjviEAsny+U5fg vD63qhtz0ZUe7e/4ESjdhd/oIbs1FG6gYdwOS4CxHcK95NoJkEEcQ+yB+ytdaOGc+kw9 sSyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=mQS2xGUOyFCXcKi7cY8ON4rKUBeeiIF7wyVFVplPc/g=; b=kD/rUoqwMlp4J5lZbCIbCTIuTW7c2nnfDbzew58fzqPp/g6tEjXgCXJIIEkHrfYDbL rQpB3lj2Bb6TgM7lzGDX4L+dZkfjYliXMCQoJrda90d4ZLFMH1OShnM2KxvClcOY0Yfj E/G4JzJcBgnnz14pGc0RI2ihOYvJG+f6/tDrwOXXpmb/izZThgrZqI5wxwXXuOJHQ4cw AU9aNxQ+BmwrXxzLhS29o0eLFhiuvWZq+WPqu1XI4ZoHBCr9vnVq37bLQDXydAkQKx+7 EVPjAaicjXkkZKn6WClb47mAu1n81ITDLgiCv7HzS7HF7krATG16un7oc+UTcuOzdK7F +Tog== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p185-v6si10690688pga.476.2018.07.01.19.17.32; Sun, 01 Jul 2018 19:17:46 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932825AbeGBCL2 (ORCPT + 99 others); Sun, 1 Jul 2018 22:11:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57810 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932328AbeGBCL1 (ORCPT ); Sun, 1 Jul 2018 22:11:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 733A583207; Mon, 2 Jul 2018 02:11:26 +0000 (UTC) Received: from localhost (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F13C111DCEE; Mon, 2 Jul 2018 02:11:25 +0000 (UTC) Date: Mon, 2 Jul 2018 10:11:21 +0800 From: Baoquan He To: Pavel Tatashin Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, mhocko@suse.com, linux-mm@kvack.org, dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, jrdr.linux@gmail.com, gregkh@linuxfoundation.org, vbabka@suse.cz, richard.weiyang@gmail.com, dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, osalvador@techadventures.net Subject: Re: [PATCH v3 1/2] mm/sparse: add sparse_init_nid() Message-ID: <20180702021121.GL3223@MiWiFi-R3L-srv> References: <20180702020417.21281-1-pasha.tatashin@oracle.com> <20180702020417.21281-2-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180702020417.21281-2-pasha.tatashin@oracle.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Jul 2018 02:11:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 02 Jul 2018 02:11:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, Thanks for your quick fix. You might have missed another comment to v2 patch 1/2 which is at the bottom. On 07/01/18 at 10:04pm, Pavel Tatashin wrote: > +/* > + * Initialize sparse on a specific node. The node spans [pnum_begin, pnum_end) > + * And number of present sections in this node is map_count. > + */ > +void __init sparse_init_nid(int nid, unsigned long pnum_begin, > + unsigned long pnum_end, > + unsigned long map_count) > +{ > + unsigned long pnum, usemap_longs, *usemap, map_index; > + struct page *map, *map_base; > + > + usemap_longs = BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS); > + usemap = sparse_early_usemaps_alloc_pgdat_section(NODE_DATA(nid), > + usemap_size() * > + map_count); > + if (!usemap) { > + pr_err("%s: usemap allocation failed", __func__); > + goto failed; > + } > + map_base = sparse_populate_node(pnum_begin, pnum_end, > + map_count, nid); > + map_index = 0; > + for_each_present_section_nr(pnum_begin, pnum) { > + if (pnum >= pnum_end) > + break; > + > + BUG_ON(map_index == map_count); > + map = sparse_populate_node_section(map_base, map_index, > + pnum, nid); > + if (!map) { Here, I think it might be not right to jump to 'failed' directly if one section of the node failed to populate memmap. I think the original code is only skipping the section which memmap failed to populate by marking it as not present with "ms->section_mem_map = 0". > + pr_err("%s: memory map backing failed. Some memory will not be available.", > + __func__); > + pnum_begin = pnum; > + goto failed; > + } > + check_usemap_section_nr(nid, usemap); > + sparse_init_one_section(__nr_to_section(pnum), pnum, map, > + usemap); > + map_index++; > + usemap += usemap_longs; > + } > + return; > +failed: > + /* We failed to allocate, mark all the following pnums as not present */ > + for_each_present_section_nr(pnum_begin, pnum) { > + struct mem_section *ms; > + > + if (pnum >= pnum_end) > + break; > + ms = __nr_to_section(pnum); > + ms->section_mem_map = 0; > + } > +} > + > /* > * Allocate the accumulated non-linear sections, allocate a mem_map > * for each and record the physical to section mapping. > -- > 2.18.0 >