Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp364560img; Thu, 28 Mar 2019 01:05:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFR97Ebl+oCdVOS3Yk7R9uDT1ftbHXYTfRD4kfT3kqNsnoMINrFMLUmzt+WjfNpXcpgXEz X-Received: by 2002:a17:902:9a88:: with SMTP id w8mr42031190plp.8.1553760331701; Thu, 28 Mar 2019 01:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553760331; cv=none; d=google.com; s=arc-20160816; b=c+Wxuuw7sGgAI/6YHAS8jxaVKYuBGr7Hm5Bf+EXDyjSW+JzOW3Kedja8+TsMagX7SY p5BepRHDjtPwoYWhwVmGxxyHP1QPCl27KQcC2cFFb4jwLX03Usiahuo73ILzVaPYaL1Q TT4e7ehLC2Z4qsjuMmii6fQDShmrevK6zqSLKhwKEETufo25AxPDwODjeRaKAv/raYMV MgK8DEQDBoMx4N4+vmrS8IrMVdZHZuZuPc9KNnRclftJYZIes1zDYX2YS7yCcJIz67J1 ilGk7qjlXE3w1hlnJzirwB8PqIu4oFFSn5iL+D7pVbuj8cdbsk6Ft9TjsB+b4j+TCMcR NJOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=d/2ljfEVChtzFWV+BkRAjLEOSS3XnNtu07vTgtvsGtw=; b=HXZ9dhEhH9dlImIg83C7DaXj7z66gBH3SaXAmzApngCUPxsdnWrr4hqHf6GjrmRuMx hlan+SXwGu8ONST3eUq+RF9mAK6ha4EZ8SkicrI6MQFiUZ9codS15vBZL6+8wkHnkgwW acT+h7Njzu2U4d3Rkk5nncxFZgy72Uq0SchM79KSc1Hxxt5gB6UNiBux375UF0jHSis8 yBziYL8AML7JKdrWuo217AzmjAGtaGCZavKU0c+O7cv0693uegEUz8Bii+gLrIv078fE 33BVpwPZ4snlwxkX8CU5BG7hNQe9ZwXzvWk9Ywrox2+PA+2QkadfHorUXdoU/cJPi4oi 2bAA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si21171135pls.231.2019.03.28.01.05.16; Thu, 28 Mar 2019 01:05:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbfC1ICg (ORCPT + 99 others); Thu, 28 Mar 2019 04:02:36 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:52429 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbfC1ICf (ORCPT ); Thu, 28 Mar 2019 04:02:35 -0400 Received: from p5492e2fc.dip0.t-ipconnect.de ([84.146.226.252] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1h9Pzd-0005AJ-G5; Thu, 28 Mar 2019 09:02:33 +0100 Date: Thu, 28 Mar 2019 09:02:33 +0100 (CET) From: Thomas Gleixner To: Wei Yang cc: x86@kernel.org, linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.or Subject: Re: [PATCH 4/6] x86, mm: make split_mem_range() more easy to read In-Reply-To: <20190328065117.GA6202@richard> Message-ID: References: <20190212021215.13247-1-richardw.yang@linux.intel.com> <20190212021215.13247-5-richardw.yang@linux.intel.com> <20190328065117.GA6202@richard> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wei, On Thu, 28 Mar 2019, Wei Yang wrote: please trim your replies. It's annoying if one has to search the content in the middle of a large useless quote. > On Sun, Mar 24, 2019 at 03:29:04PM +0100, Thomas Gleixner wrote: > >Wei, > >-static int __meminit split_mem_range(struct map_range *mr, int nr_range, > >- unsigned long start, > >- unsigned long end) > >-{ > >- unsigned long start_pfn, end_pfn, limit_pfn; > >- unsigned long pfn; > >- int i; > >+ if (!IS_ALIGNED(mr->end, mi->size)) { > >+ /* Try to fit as much as possible */ > >+ len = round_down(mr->end - mr->start, mi->size); > >+ if (!len) > >+ return false; > >+ mr->end = mr->start + len; > >+ } > > > >- limit_pfn = PFN_DOWN(end); > >+ /* Store the effective page size mask */ > >+ mr->page_size_mask = mi->mask; > > I don't get the point here. Why store the effective page size mask just for > the "middle" range. > > The original behavior will set the "head" and "tail" range with a lower level > page size mask. What has this to do with the middle range? Nothing. This is the path where the current map level (1g, 2m, 4k) is applied from mr->start to mr->end. That's the effective mapping of this map_range entry. Thanks, tglx