Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp56615imm; Wed, 5 Sep 2018 13:38:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZgOBR68rdGpv058SNbxncG5G53hVHQwL7nliIQvuntFuba+EhnhOLlYQ7QoDK0r20YfIQb X-Received: by 2002:a63:a053:: with SMTP id u19-v6mr38494924pgn.394.1536179902074; Wed, 05 Sep 2018 13:38:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536179902; cv=none; d=google.com; s=arc-20160816; b=iP5z5jeVivJYSprx0zIzSMqaA2rA1BSGclJtKbAJ/Hg9T/a1jQ6b0CDbWztX649Di9 c7okwBlYZbfKrHAsxoVvQX94GbHrMrsKfK/jGjAKZtwMOYK9cCvsRDW/xF2i3c4sHVWI 9FiOpryJax4s1JjbVX+fbvYRcUpVImwvSjrUuIcI7jAoxP5B1RU7pu0Ubb/3m6o3MNMc GGORRUuq6d9xVjrJG3R71RDiyMcZMfdomHz9NBMPVd7G4+VWfXn63bS4X8GsXB+Gfm1y 8KrCrBqoEUMOQhkykE9doAvGxpEYOZXSqUjy7v0+qXlIDGM18Paf53CF7UKNVXQUmrR8 Uzkw== 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; bh=M6DxylLr/YiUzXV5RmOTu6Mbl/BCWyKG6XOwKTdCzOY=; b=aZNyBAUfkDPm65OFI+lhc2U5LlEq8wvYsy0oFXzHjNAs8E/o6z2uMiUQ9c7uM20D2e HKjlbMc//XFh2MU9Nlu6bv6E2AAVX0xnEtrYIq3uXu7PHb+3yPbyzHQkDUXbzDHj2vAE jVBT34iypEEWOv3WgJlqAE14Etj/FdV7+pf3JWy4t4Lv1EwLEH/4bZNLA3Vp45yGPKY/ ERRrQWPu6acVBOuV1IIhTVnVYP8FbGJPy0OebVGrCKv5llJR6bTOcVwbAcLpS4BoaKXG /FisJYrkj0ge/GdiaPrBHGkH0MZkI52NHgVdRMkDE3Tojai+QCfsreJnY2SbegzUwUYN S86g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MMiyA17n; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u42-v6si2992202pgn.86.2018.09.05.13.37.56; Wed, 05 Sep 2018 13:38:22 -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=@gmail.com header.s=20161025 header.b=MMiyA17n; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728040AbeIFBHQ (ORCPT + 99 others); Wed, 5 Sep 2018 21:07:16 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:43509 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727599AbeIFBHQ (ORCPT ); Wed, 5 Sep 2018 21:07:16 -0400 Received: by mail-io0-f196.google.com with SMTP id y10-v6so7079503ioa.10 for ; Wed, 05 Sep 2018 13:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M6DxylLr/YiUzXV5RmOTu6Mbl/BCWyKG6XOwKTdCzOY=; b=MMiyA17nMp1AdpzA62Cm+LrrQWY7XhfbH8kByicmOu4e6W7BxX2pokcQomNSsuU9Z2 EpfnPsJjI9Ml4BwgRwuYu/Y8tmCvofVscZ3x4JvmebR+51sciPv5RwuYvnNLTxRmsnF2 ZVqX+Bs+b/lxc8HnC45dh32hjsrY0vwmlu4mtNE+O0A2ZVe/1+Qi+TYFvBPY8LKj1/F9 eaj8Vg6tJPFZVBVVbBL85XOzhD/MnIpGCgVH5P7Nd+Vv+SKIissmV/5qOONdNMdcvSBT jj/5dRlceHH/c78qkqWtoJDJHmZNHPaMycgaXqtt6tXegsApJq6TbPFAhOIBNQ65Rdbl k6jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M6DxylLr/YiUzXV5RmOTu6Mbl/BCWyKG6XOwKTdCzOY=; b=ELPVjDWzmzXA6rzoYSCVtToWHbV4BjYuU6me0fE8Ov3miT52NtKM120CaqDr9dmwVC J5VY2PtuAbKKKUPkXz7DLycUokibAZ/vYa5wPGAfLSxKDQ00mYpCQdFOZBsYoYH92wAD RpFxCLI88uNFgqgnqdWHKmsixEB2bsu5R0N3J8QyNiJnQuWmjG0HOc3RW9E0VFwOFXD1 W1CUEuRfhrJP7zhcWc+s4Q6Vz0qPduCg/UK3lC3p39l4HMpTboBsESF9llsFalo8kTkk 0ckbkPVI0c9sOSA1kVHldCOkByb4yV3fzO768tWH+DogFAuGq7FKNL+7MN/COOPTq0Of s+CA== X-Gm-Message-State: APzg51AJ8JhNCm9INSXijV//OpouLt/TFFxV375eAO6qs8e+Wcr71QDs 7gULSdOrm2qGOtF+oQ21yPvfvOsS6fMGl1l+17E= X-Received: by 2002:a6b:cac3:: with SMTP id a186-v6mr27250299iog.116.1536179723982; Wed, 05 Sep 2018 13:35:23 -0700 (PDT) MIME-Version: 1.0 References: <20180904181550.4416.50701.stgit@localhost.localdomain> <20180904183345.4416.76515.stgit@localhost.localdomain> <20180905062428.GV14951@dhcp22.suse.cz> In-Reply-To: From: Alexander Duyck Date: Wed, 5 Sep 2018 13:35:11 -0700 Message-ID: Subject: Re: [PATCH 2/2] mm: Create non-atomic version of SetPageReserved for init use To: Pavel.Tatashin@microsoft.com Cc: mhocko@kernel.org, linux-mm , LKML , "Duyck, Alexander H" , Andrew Morton , Ingo Molnar , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 5, 2018 at 1:22 PM Pasha Tatashin wrote: > > > > On 9/5/18 4:18 PM, Alexander Duyck wrote: > > On Tue, Sep 4, 2018 at 11:24 PM Michal Hocko wrote: > >> > >> On Tue 04-09-18 11:33:45, Alexander Duyck wrote: > >>> From: Alexander Duyck > >>> > >>> It doesn't make much sense to use the atomic SetPageReserved at init time > >>> when we are using memset to clear the memory and manipulating the page > >>> flags via simple "&=" and "|=" operations in __init_single_page. > >>> > >>> This patch adds a non-atomic version __SetPageReserved that can be used > >>> during page init and shows about a 10% improvement in initialization times > >>> on the systems I have available for testing. > >> > >> I agree with Dave about a comment is due. I am also quite surprised that > >> this leads to such a large improvement. Could you be more specific about > >> your test and machines you were testing on? > > > > So my test case has been just initializing 4 3TB blocks of persistent > > memory with a few trace_printk values added to track total time in > > move_pfn_range_to_zone. > > > > What I have been seeing is that the time needed for the call drops on > > average from 35-36 seconds down to around 31-32. > > Just curious why is there variance? During boot time is usually pretty > consistent, as there is only one thread and system is in pretty much the > same state. > > A dmesg output in the commit log would be helpful. > > Thank you, > Pavel The variance has to do with the fact that it is being added via hot-plug. So in this case the system boots and then after 5 minutes it then goes about hot-plugging the memory. The memmap_init_zone call will make regular calls into cond_resched() and it seems like if there are any other active threads that can end up impacting the timings and provide a few hundred ms of variation between runs. In addition there is also NUMA locality that plays a role. I have seen values as low as 25.5s pre-patch, 23.2 after, and values as high as 39.17 pre-patch, 37.3 after. I am assuming that the lowest values just happened to luck into being node local, and the highest values end up being 2 nodes away on the 4 node system I am testing. I'm planning to try and address the NUMA issues using an approach similar to what the deferred_init is already doing by trying to start a kernel thread on the correct node and then probably just waiting on that to complete outside of the hotplug lock. The solution will end up being a hybrid probably between the work Dan Williams had submitted a couple months ago and the existing deferred_init code. But I will be targeting that for 4.20 at the earliest. - Alex