Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6315ybe; Tue, 10 Sep 2019 13:31:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwLttADM1fkj45Tc7DywvfZ5X22SxgCgkyuDNMGnNQMrsFtdb1XTrPcY2z5pb8G7iwnSB1 X-Received: by 2002:a05:6402:b04:: with SMTP id bm4mr33332337edb.196.1568147475470; Tue, 10 Sep 2019 13:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568147475; cv=none; d=google.com; s=arc-20160816; b=SSamAnIffpdQUSGCJXnuAop0h08nYiHrU9YUx9tfisM0jAs/47ivNPcOiAFG+JSGSk bt6QHGOKbOBElEgAqByTSQiEOeLN1c324APXSl02GVS7g2bOGxvRjSa0RVwJEQWAvFLv xpedqif8PsF0YPo30kEWJ4rQe/xNk7VOi8afp86orFOcTQHuF0wFZmUOUIV1ZpzwF1st EF0ktvYKZnipAw9t0Xn19TM8G630nPedK1/pFO2ob9tRBJNXxfSEeRG+8w39wmi2R/Bv FusoHqdtOnybtyyC6+3i7FJY9v7nKynvS1ClJhWzs8B7TxQrGOYNVD4tqjLUatD0CioF CXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=opz2h+vVXFTuBBcrx4LALEv9cnQIw4cFm0VD8CkNuzY=; b=gWh5bLdW0QAFoT8ngqM2vVatVvR1AxzM9yoX5f2B2VqbYUp9gPFqAABPyLUbvMKGB/ 2TmAuCE2pMGCmnOir8RhVEqcrIbrjg/WtcHPokLLu2QHeqwoqV+rkTQlJSS5leaqqCWJ gndgKi+CPHC2VBtbWXcsWSIH7FjnVUv60MYcdDlV7GIiWwqRG0fUNqZcprizNgQ40boh cyfY47EfK0T2MyxaAPcscMOIVSrRJY3GG5/ZU0HAsDxDBRHbJf4D7pKJGIBX9w573PC8 wlwvpoGfPRPt+xKcCgcTxqcvs/BnCM2xJwTm5/H5CnE+y/W+VTi8erioXx8UFDH1Bpg2 XT3w== 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 53si11477622edz.275.2019.09.10.13.30.48; Tue, 10 Sep 2019 13:31:15 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726108AbfIJU00 (ORCPT + 99 others); Tue, 10 Sep 2019 16:26:26 -0400 Received: from mga07.intel.com ([134.134.136.100]:38771 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725263AbfIJU0Z (ORCPT ); Tue, 10 Sep 2019 16:26:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2019 13:26:25 -0700 X-IronPort-AV: E=Sophos;i="5.64,490,1559545200"; d="scan'208";a="175429665" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2019 13:26:24 -0700 Message-ID: Subject: Re: [PATCH v9 3/8] mm: Move set/get_pcppage_migratetype to mmzone.h From: Alexander Duyck To: Michal Hocko , Alexander Duyck Cc: virtio-dev@lists.oasis-open.org, kvm list , "Michael S. Tsirkin" , Catalin Marinas , David Hildenbrand , Dave Hansen , LKML , Matthew Wilcox , linux-mm , Andrew Morton , will@kernel.org, linux-arm-kernel@lists.infradead.org, Oscar Salvador , Yang Zhang , Pankaj Gupta , Konrad Rzeszutek Wilk , Nitesh Narayan Lal , Rik van Riel , lcapitulino@redhat.com, "Wang, Wei W" , Andrea Arcangeli , ying.huang@intel.com, Paolo Bonzini , Dan Williams , Fengguang Wu , "Kirill A. Shutemov" Date: Tue, 10 Sep 2019 13:26:24 -0700 In-Reply-To: <20190910174553.GC4023@dhcp22.suse.cz> References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172528.10910.37051.stgit@localhost.localdomain> <20190910122313.GW2063@dhcp22.suse.cz> <20190910174553.GC4023@dhcp22.suse.cz> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-09-10 at 19:45 +0200, Michal Hocko wrote: > On Tue 10-09-19 07:46:50, Alexander Duyck wrote: > > On Tue, Sep 10, 2019 at 5:23 AM Michal Hocko wrote: > > > On Sat 07-09-19 10:25:28, Alexander Duyck wrote: > > > > From: Alexander Duyck > > > > > > > > In order to support page reporting it will be necessary to store and > > > > retrieve the migratetype of a page. To enable that I am moving the set and > > > > get operations for pcppage_migratetype into the mm/internal.h header so > > > > that they can be used outside of the page_alloc.c file. > > > > > > Please describe who is the user and why does it needs this interface. > > > This is really important because migratetype is an MM internal thing and > > > external users shouldn't really care about it at all. We really do not > > > want a random code to call those, especially the set_pcppage_migratetype. > > > > I was using it to store the migratetype of the page so that I could > > find the boundary list that contained the reported page as the array > > is indexed based on page order and migratetype. However on further > > discussion I am thinking I may just use page->index directly to index > > into the boundary array. Doing that I should be able to get a very > > slight improvement in lookup time since I am not having to pull order > > and migratetype and then compute the index based on that. In addition > > it becomes much more clear as to what is going on, and if needed I > > could add debug checks to verify the page is "Reported" and that the > > "Buddy" page type is set. > > Be careful though. A free page belongs to the page allocator and it is > free to reuse any fields for its purpose so using any of them nilly > willy is no go. If you need to stuff something like that then there > better be an api the allocator is aware of. My main objection is the > abuse migrate type. There might be other ways to express what you need. > Please make sure you clearly define that though. I will. Basically if the Reported is set then it will mean that the index value is in use and provides the index into the boundary array. The Reported flag will be cleared when the page is pulled from the buddy list and in the case of the page being allocated it is already overwritten by __rmqueue_smallest calling set_pcppage_migratetype which is what gave me the idea to just use that in the first place.