Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8033826ybn; Tue, 1 Oct 2019 02:03:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVRfqE/0eoeJf8KPGoM6wAJVite/Zo/PdGKcADTuaNQV+VClGop1cNoDAAjw/HVx8W8+Oo X-Received: by 2002:aa7:c5c2:: with SMTP id h2mr24671362eds.260.1569920592574; Tue, 01 Oct 2019 02:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569920592; cv=none; d=google.com; s=arc-20160816; b=FozHosEgEPKh/ns6MqMAnODsXgTr0bdOGREXtKKT9MlgyB22Un/xOxZci7acgiUkTP g0JssZGsVLA2kvj4EEM57lfIEbyyemaiGtaX2ga/bGBi5FE33MOrTDZ0oqt5tcTxoswr H6UcYYBQnR2CW2n93n1eCFFH+kJazgGSc+KWqVjIA16EzINYGd0AqgnfPPZt39aTPK6G Qjt634Bjdgmb/n08UUMb+4yMVL/LIoUkhVNf5F4MJpavQUxzniJ+2WtwZ/VytFEaNUtU Gbk1aSoh8b7uZFBnrYeeK8OY6jDwjPwsFdFjj9vKMohOZVCFmmtFasz+8PnP/wNPxaHU 6DFQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=a7TBNIVPLg+vXIOzVgimkdATt6Se3daDpXQ8Kf4+E4c=; b=sabobi/xBqOXz/OQdRfcN/IaJadtRfkaTBrXtxgW5AlbnDsmRg/Xyh2QcM4op6iHhG z3t98Ddzm1FBS37G9DxyZilL1E8fjsG3cpgNf17xKOpyo3dA/mgm55gCZZqG7ey1pjb+ 3NkWoZlGLcMTPcPEylCccGfWicgQiFTZTfv+VxNPYfSIYzZC3SN2v+Q08UFVIbPW71Gt S2s7zC/I47rThEBj2gb99uqOJ0j0wTOouZzCb/2MWLIlhSmvyT7TyGQ8EpBfUuAp7bbE rvQQ7lEEKQhMf6mi/VRQQ25dsSZ4gaaCWJ15Ma21bAWjmHj4R0zaoilDMHRLXucU/r54 P53w== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nj7si8529050ejb.262.2019.10.01.02.02.47; Tue, 01 Oct 2019 02:03:12 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733232AbfJAJCC (ORCPT + 99 others); Tue, 1 Oct 2019 05:02:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47270 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729787AbfJAJCB (ORCPT ); Tue, 1 Oct 2019 05:02:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D1C58980F9; Tue, 1 Oct 2019 09:02:01 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-182.ams2.redhat.com [10.36.117.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B09D60624; Tue, 1 Oct 2019 09:01:59 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, xen-devel@lists.xenproject.org, David Hildenbrand , Boris Ostrovsky , Juergen Gross , Stefano Stabellini Subject: [PATCH v1 2/3] xen/balloon: Mark pages PG_offline in balloon_append() Date: Tue, 1 Oct 2019 11:01:51 +0200 Message-Id: <20191001090152.1770-3-david@redhat.com> In-Reply-To: <20191001090152.1770-1-david@redhat.com> References: <20191001090152.1770-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 01 Oct 2019 09:02:01 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's move the __SetPageOffline() call which all callers perform into balloon_append(). In bp_state decrease_reservation(), pages are now marked PG_offline a little later than before, however, this should not matter for XEN. Suggested-by: Boris Ostrovsky Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Signed-off-by: David Hildenbrand --- drivers/xen/balloon.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 37443c5fda99..8c245e99bb06 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -158,6 +158,8 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); /* balloon_append: add the given page to the balloon. */ static void balloon_append(struct page *page) { + __SetPageOffline(page); + /* Lowmem is re-populated first, so highmem pages go at list tail. */ if (PageHighMem(page)) { list_add_tail(&page->lru, &ballooned_pages); @@ -372,7 +374,6 @@ static void xen_online_page(struct page *page, unsigned int order) for (i = 0; i < size; i++) { p = pfn_to_page(start_pfn + i); __online_page_set_limits(p); - __SetPageOffline(p); balloon_append(p); } mutex_unlock(&balloon_mutex); @@ -466,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) state = BP_EAGAIN; break; } - __SetPageOffline(page); adjust_managed_page_count(page, -1); xenmem_reservation_scrub_page(page); list_add(&page->lru, &pages); @@ -648,10 +648,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) mutex_lock(&balloon_mutex); for (i = 0; i < nr_pages; i++) { - if (pages[i]) { - __SetPageOffline(pages[i]); + if (pages[i]) balloon_append(pages[i]); - } } balloon_stats.target_unpopulated -= nr_pages; @@ -669,7 +667,6 @@ static void __init balloon_add_region(unsigned long start_pfn, unsigned long pages) { unsigned long pfn, extra_pfn_end; - struct page *page; /* * If the amount of usable memory has been limited (e.g., with @@ -679,12 +676,10 @@ static void __init balloon_add_region(unsigned long start_pfn, extra_pfn_end = min(max_pfn, start_pfn + pages); for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) { - page = pfn_to_page(pfn); /* totalram_pages and totalhigh_pages do not include the boot-time balloon extension, so don't subtract from it. */ - __SetPageOffline(page); - balloon_append(page); + balloon_append(pfn_to_page(pfn)); } balloon_stats.total_pages += extra_pfn_end - start_pfn; -- 2.21.0