Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5353375ybe; Tue, 10 Sep 2019 02:19:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiu67zJxaF7+pU6vaggPL0DopPLaLaHKxpy1tIBbDyG1aq0tcZsCtTxaV3jS3t4HLija72 X-Received: by 2002:a05:6402:7d1:: with SMTP id u17mr29187569edy.132.1568107181884; Tue, 10 Sep 2019 02:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568107181; cv=none; d=google.com; s=arc-20160816; b=WBuMy8eGEnIT9s+zTHBkNP0YNCG7yO7YChWleQZZ6STipRMxvA7dBQAm9alJAAMuon fFHn3DQt3iEQpJLzCp4xsVG/NKJbNhjDGlSBOV8hzHvOMs6l8J4Rklgr6qWcbYI6+Ucx JNmnXGpKUzLg2EGcrMmoIZ1xkYdlv2eWMDUvwHTK8QdtSabjfTl1qSy/hOMRsTi6Xirx JdGpf5uRG3NqnwmQbjdkVNXcfgtNRYE2+yhG7EHjPGTdIIlEzgwuQ3wHSshIH/5J8Sub XDcnzkj/enhViNZl5Z1ZjmxWJSvXkPnDMFw6vhYZW1M+vIxhWKvzr0kTw1f+CFmprirs vxsQ== 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=4orrHJC4jQgAHh0reyDVLWyUSrQ8iHo5RyNTAMSoArU=; b=DDBpW7dfZhc1Tb0haHyLizcIhW8CnUTO//GxG107oXu/f0FvcB81Y2IIVII3GFsDKH fjp3EUVfx9/KFCLAq/Y7UPO/N3nWzCLY443eCXSEBca+hX/RYDavrhNAqINBG+0jFp81 cMVHNOKE19yBuUCDTfTCHaJhBPen3tbwEekxuVj8PCtMegBKpbglshDr4VQKtZeiXrli Yo/dZl/b1nOwlYYoOmnxFgvCbEH+GFZgWbhYjXGzXVXmX8inDtMsUlIkLKUxFfDOgslT IOW2UmV/JYaZudyQdeFTji/qXxYd5tbadSZj326Cb6yG1NbUnIXipp5lAunYEjH8qbJL FXKA== 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 57si10678137edz.280.2019.09.10.02.19.18; Tue, 10 Sep 2019 02:19:41 -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 S2405479AbfIISMl (ORCPT + 99 others); Mon, 9 Sep 2019 14:12:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:24313 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405425AbfIISMe (ORCPT ); Mon, 9 Sep 2019 14:12:34 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 11:12:34 -0700 X-IronPort-AV: E=Sophos;i="5.64,486,1559545200"; d="scan'208";a="178428271" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 11:12:33 -0700 Message-ID: <576de40e00083206bdb0c2e9f04fe34dd406e6b3.camel@linux.intel.com> Subject: Re: [PATCH v9 3/8] mm: Move set/get_pcppage_migratetype to mmzone.h From: Alexander Duyck To: "Kirill A. Shutemov" , Alexander Duyck Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, mst@redhat.com, catalin.marinas@arm.com, david@redhat.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, will@kernel.org, linux-arm-kernel@lists.infradead.org, osalvador@suse.de, yang.zhang.wz@gmail.com, pagupta@redhat.com, konrad.wilk@oracle.com, nitesh@redhat.com, riel@surriel.com, lcapitulino@redhat.com, wei.w.wang@intel.com, aarcange@redhat.com, ying.huang@intel.com, pbonzini@redhat.com, dan.j.williams@intel.com, fengguang.wu@intel.com, kirill.shutemov@linux.intel.com Date: Mon, 09 Sep 2019 11:12:33 -0700 In-Reply-To: References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172528.10910.37051.stgit@localhost.localdomain> <20190909095608.jwachx3womhqmjbl@box> 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 Mon, 2019-09-09 at 11:01 -0700, Alexander Duyck wrote: > On Mon, 2019-09-09 at 12:56 +0300, Kirill A. Shutemov wrote: > > On Sat, Sep 07, 2019 at 10:25:28AM -0700, 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. > > > > > > Reviewed-by: Dan Williams > > > Signed-off-by: Alexander Duyck > > > > I'm not sure that it's great idea to export this functionality beyond > > mm/page_alloc.c without any additional safeguards. How would we avoid to > > messing with ->index when the page is not in the right state of its > > life-cycle. Can we add some VM_BUG_ON()s here? > > I am not sure what we would need to check on though. There are essentially > 2 cases where we are using this. The first is the percpu page lists so the > value is set either as a result of __rmqueue_smallest or > free_unref_page_prepare. The second one which hasn't been added yet is for > the Reported pages case which I add with patch 6. > > When I use it for page reporting I am essentially using the Reported flag > to identify what pages in the buddy list will have this value set versus > those that may not. I didn't explicitly define it that way, but that is > how I am using it so that the value cannot be trusted unless the Reported > flag is set. I guess the alternative would be to just treat the ->index value as the index within the boundary array, and not use the per-cpu list functions. Doing that might make things a bit more clear since all we are really doing is storing the index into the boundary list the page is contained in. I could probably combine the value of order and migratetype and save myself a few cycles in the process by just saving the index into the array directly.