From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 300B5C49ED9 for ; Tue, 10 Sep 2019 17:46:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC27C2168B for ; Tue, 10 Sep 2019 17:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568137561; bh=nhozy1+SIp5fZkkmBLeMpwh1CRoYgJBvilyJiNcb0+k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=G21rdO22VMj3hUAkK5uv91HgE3Q2PNQ2iduQsnOy5xH1m481h/AEHc+mWvl/NipDy i4IYKEnsvJL7sQAqSQDs4ttqud1FBHYoTsdnB9/nVNgRL4za5mqVsfSXAt2OUq4Srs VPE3RMl6d4u0c9mvYfIlbjW7TqDGbI3ZoyR8s1zs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437166AbfIJRp5 (ORCPT ); Tue, 10 Sep 2019 13:45:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:44990 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437122AbfIJRp5 (ORCPT ); Tue, 10 Sep 2019 13:45:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E89D9AD17; Tue, 10 Sep 2019 17:45:54 +0000 (UTC) Date: Tue, 10 Sep 2019 19:45:53 +0200 From: Michal Hocko To: 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 , Alexander Duyck , "Kirill A. Shutemov" Subject: Re: [PATCH v9 3/8] mm: Move set/get_pcppage_migratetype to mmzone.h Message-ID: <20190910174553.GC4023@dhcp22.suse.cz> References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172528.10910.37051.stgit@localhost.localdomain> <20190910122313.GW2063@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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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. -- Michal Hocko SUSE Labs