From patchwork Sun Dec 20 08:27:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11983817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D9BEC4361B for ; Sun, 20 Dec 2020 08:28:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19F6523A5E for ; Sun, 20 Dec 2020 08:28:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19F6523A5E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C73856B0068; Sun, 20 Dec 2020 03:28:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C25E56B006C; Sun, 20 Dec 2020 03:28:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B39646B006E; Sun, 20 Dec 2020 03:28:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 9CF346B0068 for ; Sun, 20 Dec 2020 03:28:07 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5BCB33641 for ; Sun, 20 Dec 2020 08:28:07 +0000 (UTC) X-FDA: 77612983014.28.arch84_460bb4c2744d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 41A656C3E for ; Sun, 20 Dec 2020 08:28:07 +0000 (UTC) X-HE-Tag: arch84_460bb4c2744d X-Filterd-Recvd-Size: 3569 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Sun, 20 Dec 2020 08:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608452885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=DUjf0b7Cp0HBk1u4zghdBX7mQ4cTJHbAWmAcP28K9Oo=; b=hq68T6dcKKT5M7pPfRghFASlvUT+T4cWtiBKuJd0BFfwP0vgIseVCYuuI7CYpN+1x4uVe9 KM1SfFtpbJx4NGBJbZlue/j0Lr+PuKklLle5hb9X/98XMQ0OyYfMaiQ65qMb7nN9+2CNBC vLn/jYssOh+GKbCmv7WRmwGWuZe+xGc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-BZpv9fMcNgmuY6AH8FCnrQ-1; Sun, 20 Dec 2020 03:28:03 -0500 X-MC-Unique: BZpv9fMcNgmuY6AH8FCnrQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B7E5800D53; Sun, 20 Dec 2020 08:28:02 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-22.pek2.redhat.com [10.72.12.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4049C60C13; Sun, 20 Dec 2020 08:27:55 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, gopakumarr@vmware.com, rppt@kernel.org, david@redhat.com, bhe@redhat.com Subject: [PATCH v2 0/5] Fix the incorrect memmep defer init handling and do some cleanup Date: Sun, 20 Dec 2020 16:27:49 +0800 Message-Id: <20201220082754.6900-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: VMware reported the performance regression during memmap_init() invocation. And they bisected to commit 73a6e474cb376 ("mm: memmap_init: iterate over memblock regions rather that check each PFN") causing it. https://lore.kernel.org/linux-mm/DM6PR05MB52921FF90FA01CC337DD23A1A4080@DM6PR05MB5292.namprd05.prod.outlook.com/ After investigation, it's caused by incorrect memmap init defer handling in memmap_init_zone() after commit 73a6e474cb376. The current memmap_init_zone() only handle one memory region of one zone, while memmap_init() iterates over all its memory regions and pass them one by one into memmap_init_zone() to handle. So in this patchset, patch 1/5 fixes the bug observed by VMware. Patch 2~5/5 clean up codes. accordingly. VMware helped do the testing for the patch 1 of v1 version which was based on master branch of Linus's tree on their VMware ESI platform, while the patch 1 is not changed in functionality in v2. And I haven't got a ia64 machine to compile or test, will really appreciate if anyone can help compile this patchset on one. This patchset is based on the latest next/master, only did the basic test. Baoquan He (5): mm: memmap defer init dosn't work as expected mm: rename memmap_init() and memmap_init_zone() mm: simplify parater of function memmap_init_zone() mm: simplify parameter of setup_usemap() mm: remove unneeded local variable in free_area_init_core arch/ia64/include/asm/pgtable.h | 3 +- arch/ia64/mm/init.c | 16 +++++---- include/linux/mm.h | 5 +-- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 60 ++++++++++++++++----------------- 5 files changed, 43 insertions(+), 43 deletions(-)