Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1069525imm; Fri, 29 Jun 2018 10:50:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQeJ5m+i6h5KzBFIeYQdRM1+3zDh6SbPt9z1/bsDCAuZL01NCPqOoR5htML+8VoLTb+3LX X-Received: by 2002:a62:820a:: with SMTP id w10-v6mr15167672pfd.71.1530294652602; Fri, 29 Jun 2018 10:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530294652; cv=none; d=google.com; s=arc-20160816; b=WG/DVjpveI1jRzBllJ5qorGmKv2EUsZk4JXlLhwUFlA8KFNeTjYz/0O52foIXw5OHE +beqhqau0XibbtzkW7RcLfBmjO6uBU+tu6MkUG+AUa1tdnxNcvJsXRerXoBdJd/WJhIM KECISCKBYZf1Lm+QSJEZgxfte6EeR1IdrYGFtssLscmD621eQN5nkY88QAQoMNl7z13k NVoU9/eauVSsfojBCRVJKbvzbyp5uFFPEzCTaeq7o7XuMFI+0NoYww6KMcHN9SzHiPZF OZ8ch+nwcS/pq6z0ModVfIBXJ0Govn/mjGl6ASRAcArTRs5Xthffx95nuOqjQyJeKC/R UAIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=ukfmZ/OIfG5FoPNIjD8F/mynhmKqnrWb7iJTGznHs7A=; b=vftlYbUWg/uUY7VcFgi/5rPJuhc/tVNrkCXMgB3gc6lOgn0e96j7Z9S83Zpq7JC/6v VdbT7i4dicRw48HHJ+0Q+EZkDU07toiXjBTxSGqD04ZK/Zo8iOO1kxPtYyN663d4Pf/l lKh2K8s4HhPmrN6VonQwRZM2J1c/eJrOs8GkvsALDGEiL2x+kzuuNhl2bE2+T//MQTzg VnjdDiFFWScRm5XehIXr8Fr4+qa3RrSQorp/p17xumAT+C+/sNXz+ZdH0aZYsfVtIa7C 7Kk1E85d+hRE1Nn9PKwPie6kwn+rH0JI0XzqEJ8eJzf/n24u/gM4bnIMTQkTvKOYPjpL Zxqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=YGEi7OuK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15-v6si6659311pfq.172.2018.06.29.10.50.37; Fri, 29 Jun 2018 10:50:52 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=YGEi7OuK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755287AbeF2Rsr (ORCPT + 99 others); Fri, 29 Jun 2018 13:48:47 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:40550 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755206AbeF2Rsq (ORCPT ); Fri, 29 Jun 2018 13:48:46 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5THmjcx104316 for ; Fri, 29 Jun 2018 17:48:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=ukfmZ/OIfG5FoPNIjD8F/mynhmKqnrWb7iJTGznHs7A=; b=YGEi7OuKSu45qNK+8GdghlbJ7dFgy3ikHGyLK94NddYJgOzyQzb8soOHv+cLlWBy3re5 N3f4VsZ4/gXdIYr5gX67/cylpTFLIDX92thA11YLKMJetLS+EqCz3bm3DSyxMg0+3CP+ JZZigm9c1WTvE+JRZ+XrgNADaJ+Ju6RB06y9YXfMJLz4Nm7upaLJWXvHSxSZmJr94fif nH/uBvEgpeGvZKM1+zVqGFzCjDC02r3GcveF2fd0TTf/S69Z+pGDF/kh7JUEvvhgxFq8 kDk24tFboU7wtU/eTfAnzePRHOyHoZb4nS3fTMFWHVpqIzp2k2M7GFtDpp9jsx5jkZ9o yA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2jukhsqja7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 Jun 2018 17:48:45 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5THmhv7016088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 29 Jun 2018 17:48:44 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5THmhCm013575 for ; Fri, 29 Jun 2018 17:48:43 GMT Received: from mail-oi0-f53.google.com (/209.85.218.53) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 29 Jun 2018 10:48:43 -0700 Received: by mail-oi0-f53.google.com with SMTP id 21-v6so9179213oip.8 for ; Fri, 29 Jun 2018 10:48:43 -0700 (PDT) X-Gm-Message-State: APt69E21/MMw0k3dFJlRz0It/CujRgdH82WYnniONFWdsD1SIxgTFisb wblEIgz48QZ75+hl0RAHU3+WbtzaEh5IYdZh2gA= X-Received: by 2002:aca:e089:: with SMTP id x131-v6mr3620498oig.221.1530294522985; Fri, 29 Jun 2018 10:48:42 -0700 (PDT) MIME-Version: 1.0 References: <20180627013116.12411-1-bhe@redhat.com> <20180627013116.12411-5-bhe@redhat.com> In-Reply-To: From: Pavel Tatashin Date: Fri, 29 Jun 2018 13:48:06 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init() To: dave.hansen@intel.com Cc: bhe@redhat.com, LKML , Andrew Morton , pagupta@redhat.com, Linux Memory Management List , kirill.shutemov@linux.intel.com Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8939 signatures=668703 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=536 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806290190 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > + * increase 'nr_consumed_maps' whether its allocation of memmap > > + * or usemap failed or not, so that after we handle the i-th > > + * memory section, can get memmap and usemap of (i+1)-th section > > + * correctly. */ > > This makes no sense to me. Why are we incrementing 'nr_consumed_maps' > when we do not consume one? > > You say that we increment it so that things will work, but not how or > why it makes things work. I'm confused. Hi Dave, nr_consumed_maps is a local counter. map_map contains struct pages for each section. In order to assign them to correct sections this local counter must be incremented even when some parts of map_map are empty. Here is example: Node1: map_map[0] -> Struct pages ... map_map[1] -> NULL Node2: map_map[2] -> Struct pages ... We always want to configure section from Node2 with struct pages from Node2. Even, if there are holes in-between. The same with usemap. Pavel