Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3690135imd; Mon, 29 Oct 2018 10:48:26 -0700 (PDT) X-Google-Smtp-Source: AJdET5c9j+zbdqnZ1fYeyNmffbMBiSyu3drZuyvhQvUIrX4rAjPdZrM4OWohZ9VGSR8bUjdoVuSB X-Received: by 2002:a17:902:3e3:: with SMTP id d90-v6mr9120383pld.118.1540835306753; Mon, 29 Oct 2018 10:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540835306; cv=none; d=google.com; s=arc-20160816; b=BxuOq+fidHORPRUOwhBloazRKyA6LXOfrnSZ/GjEhybn/NjDtPQTw9oUWsXpYhlWf0 CVnPwCTpBz4wS3NNx78n0g/V0CnopW5hT1z0PdIuFhOllmZsmj/8Om0y8o4vWsSY1hDr 9Cl28asMK8ANc1uVQoUGRBMiOD/X468rYCWttlV2eEpzoAzyK9C34vAQZRMbWtLqpsPM F1RlwRWgHRcFy9m0gLF/dEfZhwaxxrqmuzyAANcqdVz09bK6u074yEBqKoPfS8eeHcqa wHIY3uVd3LZhzW8nQhiD8KYuXWrdty/NF5FwnPrNrfjWWV8m3ozAaWP3/2SLKkkUTZN8 J6gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nbwlfzzDrQzFj+3517GKKygwe+DqAfC3tu/mXnkCmqg=; b=DoNTBEIInrEjWNLczUfbV/jZYM/wZ+B0Wu6kpQMRN+Tq+KAmezcGh97xQladALXuzs BSIMjTxPlRUssqzksWflipJxlXyH9F1RBcJEfTpSEmfMnGZFWyuGPP70/kcgYF3tffQM rQmgmMmpqx0TvavRFwAAEdg6Nif5dH6jtEra92Xu4Y8MTEwJ9mHBFGdZtPonGcjuJrtK r9yTFSHkyCZ6Qld1qM2Veax/3KEqS1nCbP3No+6fSRd5TTWSpN2WD5UMAFbYanM4rMxU ZWWAjh2V1oaYB8pf3e4hZi+oWN72yvvF59E6pCYIW5+pWfNUDfYzGEXer0YoYl5u0fzB a/Ug== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5-v6si20509952plv.256.2018.10.29.10.48.10; Mon, 29 Oct 2018 10:48:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728198AbeJ3Cf3 (ORCPT + 99 others); Mon, 29 Oct 2018 22:35:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:52254 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726205AbeJ3Cf3 (ORCPT ); Mon, 29 Oct 2018 22:35:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E0A61ABAC; Mon, 29 Oct 2018 17:45:50 +0000 (UTC) Date: Mon, 29 Oct 2018 18:45:49 +0100 From: Michal Hocko To: Dan Williams Cc: alexander.h.duyck@linux.intel.com, Linux MM , Andrew Morton , Linux Kernel Mailing List , linux-nvdimm , Pasha Tatashin , Dave Hansen , =?iso-8859-1?B?Suly9G1l?= Glisse , rppt@linux.vnet.ibm.com, Ingo Molnar , "Kirill A. Shutemov" , Zhang Yi Subject: Re: [PATCH v5 4/4] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap Message-ID: <20181029174549.GN32673@dhcp22.suse.cz> References: <20181011085509.GS5873@dhcp22.suse.cz> <6f32f23c-c21c-9d42-7dda-a1d18613cd3c@linux.intel.com> <20181017075257.GF18839@dhcp22.suse.cz> <971729e6-bcfe-a386-361b-d662951e69a7@linux.intel.com> <20181029141210.GJ32673@dhcp22.suse.cz> <84f09883c16608ddd2ba88103f43ec6a1c649e97.camel@linux.intel.com> <20181029163528.GL32673@dhcp22.suse.cz> <18dfc5a0db11650ff31433311da32c95e19944d9.camel@linux.intel.com> <20181029172415.GM32673@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 29-10-18 10:34:22, Dan Williams wrote: > On Mon, Oct 29, 2018 at 10:24 AM Michal Hocko wrote: > > > > On Mon 29-10-18 10:01:28, Alexander Duyck wrote: > > > On Mon, 2018-10-29 at 17:35 +0100, Michal Hocko wrote: > [..] > > > > You are already doing per-page initialization so I fail to see a larger > > > > unit to operate on. > > > > > > I have a patch that makes it so that we can work at a pageblock level > > > since all of the variables with the exception of only the LRU and page > > > address fields can be precomputed. Doing that is one of the ways I was > > > able to reduce page init to 1/3 to 1/4 of the time it was taking > > > otherwise in the case of deferred page init. > > > > You still have to call set_page_links for each page. But let's assume we > > can do initialization per larger units. Nothing really prevent to hide > > that into constructor as well. > > A constructor / indirect function call makes sense when there are > multiple sub-classes of object initialization, on the table I only see > 3 cases: typical hotplug, base ZONE_DEVICE, ZONE_DEVICE + HMM. I think > we can look to move the HMM special casing out of line, then we're > down to 2. Even at 3 cases we're better off open-coding than a > constructor for such a low number of sub-cases to handle. I do not > foresee more cases arriving, so I struggle to see what the constructor > buys us in terms of code readability / maintainability? I haven't dreamed of ZONE_DEVICE and HMM few years back. But anyway, let me note that I am not in love with callbacks. I find them to be a useful abstraction. I can be convinced (by numbers) that special casing inside the core hotplug code is really beneficial. But let's do that at a single place. All I am arguing against throughout this thread is the memmap_init_zone_device and the whole code duplication just because zone device need something special. -- Michal Hocko SUSE Labs