From patchwork Mon Nov 19 10:16:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10688381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C5AA13AD for ; Mon, 19 Nov 2018 10:17:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C77D29B89 for ; Mon, 19 Nov 2018 10:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00CC729C2F; Mon, 19 Nov 2018 10:17:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72DAE29C25 for ; Mon, 19 Nov 2018 10:17:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63F026B1A38; Mon, 19 Nov 2018 05:17:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5EE6B6B1A39; Mon, 19 Nov 2018 05:17:05 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B7756B1A3A; Mon, 19 Nov 2018 05:17:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 1E2586B1A38 for ; Mon, 19 Nov 2018 05:17:05 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id a199so67595056qkb.23 for ; Mon, 19 Nov 2018 02:17:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=TwA/HVyIGvjTNfBkphW8rBoqbr4Q+rjX6GbLbUZP5pw=; b=bag2j/pm+wZQmj5LI0SL4WmJSBuFhfs0GpqZ3cI24yzItibq7AJgjn/FX78865xkpp w8fZPeLfZj/zzm0tmcf5JxCeWLtQYOb5jgwoJKNyQ9Nq4OR9eUrp+fvq9N49WWBJyXpV J6eu101/qARPiL//2qD4pjdtNXEc/AV58t4BS7ruoqkCR0KV6GsjMH2jsqCghjlt3pk/ dSaCKUUPwkCv2G/Dft+jXM/pXxs+V3uEk7rWK8cY+7fnUtAYW5Cynfl6nK66J8HMGNbE bawE2wdZcQYtnoBuvd0xlkmP8dkHG2xs6kszoW7laRQNxUafHB63s2UyeOjpud4GmmUU q68g== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gJWJy0GAhcyPN/sVs0QcEddahBuTg9gk8feI7DnWE/Za+GFIWqY zdKcOaP4DwfaAnrDVGgAMEz+l+mwzLEJyhE7kc1nU4W3nOTqM7b0dDwfrvlRGgKY9idLrvABQii X6JEgIzAVyloPQna42kKzMRJkf31joV8KJvy4k4i8GOfdMR6FYBhPATU8AfLgY+T9Ug== X-Received: by 2002:a37:d1c5:: with SMTP id o66mr20407636qkl.293.1542622624893; Mon, 19 Nov 2018 02:17:04 -0800 (PST) X-Google-Smtp-Source: AJdET5duADO4Bdvmxz9LJtm47tJ/I7dRryJcjt2N6Z7/YzGP7yO83PUN5VfUPXIt/xz7VYvvbD7/ X-Received: by 2002:a37:d1c5:: with SMTP id o66mr20407594qkl.293.1542622624014; Mon, 19 Nov 2018 02:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542622623; cv=none; d=google.com; s=arc-20160816; b=To15KFpQgmAW/xcKfDjr5mtDqlZ/1lY7NA9tL7vGNp6u6xyuTgBcZAwF64/DH/Gobv rQnharyJw2x0iOI8x5zi5yedm99kOcVv6pzYvy+MJ4wQKppDz6Q8UdyDuP5pjeJTMTJT DB9GQ0+qTHPOK+UQqdgBq0/s/noeqsTEFJIOrF3tv7QyLtkGGyhR7sX6QRayLcoK+s3z /Q1uNwyx53lCYrWcLFIwgFv9vQnCUybP0bPSETlQY/QSTr4dHpT1SSvLtNFL/pxsK3f4 gsX/4yOH/bjfnwJ74IbmjP+t8PSdFAip2HPWPqMKIqqd/nvOsA/hy/xrB+dbEIaEvfHo b/xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=TwA/HVyIGvjTNfBkphW8rBoqbr4Q+rjX6GbLbUZP5pw=; b=WDSVoQzknfiMwxn2ypU0RRtx9LFbKpweupzPUjlL9sIGgf5MTzzyXi4XtTkk3MQenX CIm64MdQXjoJlwTT6lFi15WPVpgnreXJspSrcMm95ZMpz/dDZyvS/KGyRIk1riEwo0R8 b1tFvEAU/T78LeYFYX1PD9xVpVUOrGSCgGPUNLQO5QMLORpe4FGfbhGf3zi9XnfyMGY0 b0F7va9QHbT/SBw/tfgKiCIBlK+hLeOBp5stMIXDcYYIwnxarypRxAknV9bvGf7VKpew /LBo0wSr1KD1M31NciO4UgzMqPmYIb2W7k1ZbDL41eRBEnaY3l6QRPNgA9+1z+37PwsX S9Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id x7si22078903qtd.254.2018.11.19.02.17.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:17:03 -0800 (PST) Received-SPF: pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06ED388306; Mon, 19 Nov 2018 10:17:03 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-77.ams2.redhat.com [10.36.117.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06482106222E; Mon, 19 Nov 2018 10:16:56 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devel@linuxdriverproject.org, linux-fsdevel@vger.kernel.org, linux-pm@vger.kernel.org, xen-devel@lists.xenproject.org, kexec-ml , pv-drivers@vmware.com, David Hildenbrand , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Kairui Song , Vitaly Kuznetsov , Andrew Morton , Matthew Wilcox , Michal Hocko , "Michael S. Tsirkin" Subject: [PATCH v1 5/8] hv_balloon: mark inflated pages PG_offline Date: Mon, 19 Nov 2018 11:16:13 +0100 Message-Id: <20181119101616.8901-6-david@redhat.com> In-Reply-To: <20181119101616.8901-1-david@redhat.com> References: <20181119101616.8901-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 19 Nov 2018 10:17:03 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Mark inflated and never onlined pages PG_offline, to tell the world that the content is stale and should not be dumped. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Kairui Song Cc: Vitaly Kuznetsov Cc: Andrew Morton Cc: Matthew Wilcox Cc: Michal Hocko Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand Acked-by: Pankaj gupta --- drivers/hv/hv_balloon.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 211f3fe3a038..47719862e57f 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -681,8 +681,13 @@ static struct notifier_block hv_memory_nb = { /* Check if the particular page is backed and can be onlined and online it. */ static void hv_page_online_one(struct hv_hotadd_state *has, struct page *pg) { - if (!has_pfn_is_backed(has, page_to_pfn(pg))) + if (!has_pfn_is_backed(has, page_to_pfn(pg))) { + if (!PageOffline(pg)) + __SetPageOffline(pg); return; + } + if (PageOffline(pg)) + __ClearPageOffline(pg); /* This frame is currently backed; online the page. */ __online_page_set_limits(pg); @@ -1201,6 +1206,7 @@ static void free_balloon_pages(struct hv_dynmem_device *dm, for (i = 0; i < num_pages; i++) { pg = pfn_to_page(i + start_frame); + __ClearPageOffline(pg); __free_page(pg); dm->num_pages_ballooned--; } @@ -1213,7 +1219,7 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, struct dm_balloon_response *bl_resp, int alloc_unit) { - unsigned int i = 0; + unsigned int i, j; struct page *pg; if (num_pages < alloc_unit) @@ -1245,6 +1251,10 @@ static unsigned int alloc_balloon_pages(struct hv_dynmem_device *dm, if (alloc_unit != 1) split_page(pg, get_order(alloc_unit << PAGE_SHIFT)); + /* mark all pages offline */ + for (j = 0; j < (1 << get_order(alloc_unit << PAGE_SHIFT)); j++) + __SetPageOffline(pg + j); + bl_resp->range_count++; bl_resp->range_array[i].finfo.start_page = page_to_pfn(pg);