Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3762048imm; Mon, 2 Jul 2018 05:14:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLrxCPYfG4hSo8kEqLG/BBmsDLHCUuceKV1iMWafC4Jx4tWTf9XR4OiBHp+MHRbdjtW5OhJ X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr25461596plr.344.1530533681345; Mon, 02 Jul 2018 05:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530533681; cv=none; d=google.com; s=arc-20160816; b=k0dzVzxv5GCJH7ZoMxau0tYJF+HBSWYktttiH1if/oJOGc4RDmN8Azc9ljv09nxwfd DD9sK3CqZQugFhLT0Uagnu0NLWJYH35/bHUIJPdaureS4IjPrHny4PTHOmeWqAgOTX6U LklaSkIm3uw31uPwMUh7hODpa9SGQdJMkkGlbRfcIidk4qGQvvCN5nKKd/fvLDBOIrxs hcNWBb2bBjmIZbhqYleB0i8OzzI2oHbvdDON2I0Mgtx8njYaMUm+Cy/htDfnGi/87N/y 2YwZADDt4PTyEw+BupkoM1y7ZPrqnW/qPIfs2hJCQpAvpN4AnhhTmE4rtsqtTaKJ9fik Mjrg== 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=k6IMlN6kSA3EdE1GG/Cy5vYvNOnH6bSXOx0dQD3bIYM=; b=otKuaxYTgXBbUzVqNX2JzRVvfzzlmlbngUq6bUfHj7XOwFdHW68n5A6Qgd0ZaoJ79i FwGQads8kGhyrlp7soBX/rj1YvJG+CIvs6IbSMeNubSRQFF8FyJ/Ye9BWWEW2+zPebpP 4i+iN4ED25IvSPNpMV6XiHvWg4UYAzx9eMfAaixqs6D1sXpxs0lI+9jhXT/S1a4+q+DS HWycnPZBTTDJMW0jpFpnL1gh/bpXM3mTiHSi9VL0iIO6Fh55jesVbbyXBmBYpI43Wu9B 9lMjIix9jCJGl13sSmfw0l5Ky2thSUQ8yvhu2o2fSwdbYfIGu998+JHuqYJvh+t8anUz xYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=B9zzFigq; 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 f7-v6si7804879pgt.677.2018.07.02.05.14.26; Mon, 02 Jul 2018 05:14:41 -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=B9zzFigq; 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 S933856AbeGBMHe (ORCPT + 99 others); Mon, 2 Jul 2018 08:07:34 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45006 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbeGBMHb (ORCPT ); Mon, 2 Jul 2018 08:07:31 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w62C3NLw090803 for ; Mon, 2 Jul 2018 12:07:30 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=k6IMlN6kSA3EdE1GG/Cy5vYvNOnH6bSXOx0dQD3bIYM=; b=B9zzFigqB4p4lN+bg25HqqlNjD7xmUKJtSCFTiqe6sVobf8SQrXczesLSByR9vG/nEBp jvBroNOhoCRKmRvTEYZqgObfn3VgdbiQsHG+ijunu6IvYwdkvMinDNk6cEBS8MD2yvTd 4sNbJADr8hlqKMeFA2BRJEHqB276NlXPNCDPT6e0u1qr0gig1RVqYMSRn6F2fw36ICLd PRAb8mnzQZiY9jcGyT7XaxyKYk5xC6Brv3BRwb9ksMroL2wm7MS51rA1aRyOhDWgG6pH MD0fj9/zYqeYAoAf7vqzWRwxLZezCdkbtr/Q9GZz26guDa7DUk93dGsDs9wkvTg4gM/4 sA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2jx19sm83t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 02 Jul 2018 12:07:30 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w62C7RZi000967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 2 Jul 2018 12:07:28 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w62C7R35002512 for ; Mon, 2 Jul 2018 12:07:27 GMT Received: from mail-oi0-f53.google.com (/209.85.218.53) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 02 Jul 2018 05:07:27 -0700 Received: by mail-oi0-f53.google.com with SMTP id i12-v6so11478705oik.2 for ; Mon, 02 Jul 2018 05:07:27 -0700 (PDT) X-Gm-Message-State: APt69E3mgO+/XLXh1S3HlXmltpxXfIzKkaID9//TmiijjchL4/14kb7Y ++FcV8YcJkgQi1ssY0AKcWFP3gpEgK3fQZpqDVo= X-Received: by 2002:aca:3243:: with SMTP id y64-v6mr16474037oiy.136.1530533247003; Mon, 02 Jul 2018 05:07:27 -0700 (PDT) MIME-Version: 1.0 References: <1530239363-2356-1-git-send-email-hejianet@gmail.com> <20180702114037.GJ19043@dhcp22.suse.cz> In-Reply-To: <20180702114037.GJ19043@dhcp22.suse.cz> From: Pavel Tatashin Date: Mon, 2 Jul 2018 08:06:50 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 0/6] optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64 To: mhocko@kernel.org Cc: Jia He , linux@armlinux.org.uk, Andrew Morton , Catalin Marinas , Mel Gorman , will.deacon@arm.com, mark.rutland@arm.com, hpa@zytor.com, Daniel Jordan , AKASHI Takahiro , Gioh Kim , Steven Sistare , neelx@redhat.com, erosca@de.adit-jv.com, Vlastimil Babka , LKML , Linux Memory Management List , james.morse@arm.com, Ard Biesheuvel , steve.capper@arm.com, tglx@linutronix.de, mingo@redhat.com, gregkh@linuxfoundation.org, Kate Stewart , Philippe Ombredanne , Johannes Weiner , kemi.wang@intel.com, =?UTF-8?B?UGV0ciBUZXNhxZnDrWs=?= , yasu.isimatu@gmail.com, aryabinin@virtuozzo.com, nborisov@suse.com, Wei Yang Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8941 signatures=668704 X-Proofpoint-Spam-Details: rule=notspam policy=default score=3 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=3 mlxscore=3 mlxlogscore=155 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807020140 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 2, 2018 at 7:40 AM Michal Hocko wrote: > > On Fri 29-06-18 10:29:17, Jia He wrote: > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > > where possible") tried to optimize the loop in memmap_init_zone(). But > > there is still some room for improvement. > > It would be great to shortly describe those optimization from high level > POV. > > > > > Patch 1 introduce new config to make codes more generic > > Patch 2 remain the memblock_next_valid_pfn on arm and arm64 > > Patch 3 optimizes the memblock_next_valid_pfn() > > Patch 4~6 optimizes the early_pfn_valid() > > > > As for the performance improvement, after this set, I can see the time > > overhead of memmap_init() is reduced from 27956us to 13537us in my > > armv8a server(QDF2400 with 96G memory, pagesize 64k). > > So this is 13ms saving when booting 96G machine. Is this really worth > the additional code? Are there any other benefits? While 0.0144s for 96G is definitely small, I think the time is proportional to the number of pages since memmap_init() loops through all the pages. If base pages were changed to 4K, I bet the time would increase 16 times: 0.23s on given machine, in other words around 2s per 1T of memory. I agree, a high level description of optimization is needed, and also an explanation of why it would not work on other arches that support memblock. Pavel