Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3389498imu; Mon, 7 Jan 2019 02:26:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wzg1ZWGJwRhFWDPIcMy0c6TMOpE1kqy2tP6Vu1X21NqjfEf0PFsd8lGVufWJGF5MVc4ibz X-Received: by 2002:a62:1542:: with SMTP id 63mr62900327pfv.230.1546856785446; Mon, 07 Jan 2019 02:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546856785; cv=none; d=google.com; s=arc-20160816; b=oJ1HaZbdGU0INanGa198cCig8o2UEcOD+bCF2oR985laN++DTjyyw/vanUXyBikqqa gv/nFVmW6eM+iBWJUAgyBzvfUdGt/fZeJKOX4SHievR3ewBFGw0gp6dq1uJBxAJXFKJI wfXCCwBRi17zyjuO+qrOwbqH3eXUqY9l3dW+1O+rZcI6ptP6KTa+FAt5KMrHtjxHvNCs AaYEJGuCRJp/WLcT2Jyps4QoXJLtJ1LlQol6Dxy5C6A/PVikskhpWLMC5YSczt/RNT4R T3BXLz9yU2QNIWHWrdp1UjPLhQsxVpI256R9HaJuCtbHYn/p5m+4y+zsCbdxqcWTIB3u 7MwQ== 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=ezi98RPZ+ta3S9DA9eklT/S8ac9AJc+3IAj8vYLooQ0=; b=ylKtteVi+D+3aE28+gPZUiR0ywfZ0tTaCSpeK3Y1d5SyB31n4i1iSYkEBA4w4DFl4k aIVxarKq6DPXZG6tQbbzQ1iTYDosGmT76SnZ85PpTkdMsthaNkcc0/GONroHf1CPtU/X +6/Xj6CyyKPvnXpvLBFS/OVpDGeJ/RswAOZY+r/ZjNMCCZl0eCTVdKKBrrfpEYuQlRY5 CZ908qanSAxCqlnuiOlLMUs2gfrKAZ/ICvPhk9gs1j3zC3g2zqCODIDjpQ++jxhBRyZZ LnOrSieOE3NX5PdPRN/4e32VRXCNefxgwExM0l4FTwFUGygtzKHhOkwRjt13dwbKEi1v +P6g== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t75si62996736pfi.193.2019.01.07.02.26.09; Mon, 07 Jan 2019 02:26:25 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbfAGKV4 (ORCPT + 99 others); Mon, 7 Jan 2019 05:21:56 -0500 Received: from mga03.intel.com ([134.134.136.65]:2345 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfAGKV4 (ORCPT ); Mon, 7 Jan 2019 05:21:56 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2019 02:21:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,450,1539673200"; d="scan'208";a="123876940" Received: from tiwuxiex-mobl.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.213.147]) by FMSMGA003.fm.intel.com with ESMTP; 07 Jan 2019 02:21:52 -0800 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1ggS2a-0007Kx-83; Mon, 07 Jan 2019 18:21:52 +0800 Date: Mon, 7 Jan 2019 18:21:52 +0800 From: Fengguang Wu To: Dave Hansen Cc: Andrew Morton , Linux Memory Management List , Yao Yuan , kvm@vger.kernel.org, LKML , Fan Du , Peng Dong , Huang Ying , Liu Jingqi , Dong Eddie , Zhang Yi , Dan Williams Subject: Re: [RFC][PATCH v2 11/21] kvm: allocate page table pages from DRAM Message-ID: <20190107102152.d3infdyw3zupu2xj@wfg-t540p.sh.intel.com> References: <20181226131446.330864849@intel.com> <20181226133351.703380444@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 02, 2019 at 08:47:25AM -0800, Dave Hansen wrote: >On 12/26/18 5:14 AM, Fengguang Wu wrote: >> +static unsigned long __get_dram_free_pages(gfp_t gfp_mask) >> +{ >> + struct page *page; >> + >> + page = __alloc_pages(GFP_KERNEL_ACCOUNT, 0, numa_node_id()); >> + if (!page) >> + return 0; >> + return (unsigned long) page_address(page); >> +} > >There seems to be a ton of *policy* baked into these patches. For >instance: thou shalt not allocate page tables pages from PMEM. That's >surely not a policy we want to inflict on every Linux user until the end >of time. Right. It's straight forward policy for users that care performance. The project is planned by 3 steps, at this moment we are in phase (1): 1) core functionalities, easy to backport 2) upstream-able total solution 3) upstream when API stabilized The dumb kernel interface /proc/PID/idle_pages enables doing the majority policies in user space. However for the other smaller parts, it looks easier to just implement an obvious policy first. Then to consider more possibilities. >I think the more important question is how we can have the specific >policy that this patch implements, but also leave open room for other >policies, such as: "I don't care how slow this VM runs, minimize the >amount of fast memory it eats." Agreed. I'm open for more ways. We can treat these patches as the soliciting version. If anyone send reasonable improvements or even totally different way of doing it, I'd be happy to incorporate. Thanks, Fengguang