Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1687612ybi; Wed, 17 Jul 2019 20:08:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEbvJ5/4H0ps5PLlVJZVPKx57tmoBRUIGHPVsgHC1Hic0hUiWz6UfXCSVAxX/RhPJCeQAq X-Received: by 2002:a65:500a:: with SMTP id f10mr14182630pgo.105.1563419329603; Wed, 17 Jul 2019 20:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563419329; cv=none; d=google.com; s=arc-20160816; b=yCCjc697RdDW/MqA5bV6c4ONgdSxIers/Hyg4Eu7mnYnNPAG8xqfmS42SvdQAnPjbP Es8tebeNQnI+cOyDNOZNkyyRuX/p9RjsazprmfEgsNh2V0f1Pyjy3asdjB6T3djLJ1s/ TUmuW5ySUVND0lfUwvnFW65ZkLw/ArtPlxLPYEDFH4maZH64UFEjK0W009dmpjfnQcdJ Cy/FSNMucVpF26CKI1/wL9+54gm8F9TttJQbDtgL+0G1BZj91JOLEzEmPXdyFaM2bTlV psc1Kt7IfgV/HJYOmypCV1xR05yjVPlewJ6lvH5F6qvrRTLHXcOtSdJoCDkEFYnctZsw 33Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Uz7KYsL+7jV0ZNh7sINRT1FSeHHySffyy9Z9T7LnA+Q=; b=b0aKSA5wkkCL4aCatXUo/BTVt6M8lXQ+IBqJi9w3CBs6QKitTcB4JcZLQWaKSdH4wN MXebrlmXe6dF0YPNEOVh3fzYKwBmpr+Maj4lmFDeV7LhyoC84WgO7Sqha8DjgfntWWyU +fk7J96J0tRqbriqeFD5vk0rfvM/Fj3Lm3VZJ78ZoM6JXufSvRbPRF2DGKLNMa+KZsA6 FKEffN9TBupQ0nfAQZT8sHrpMT0O5r1ru0hw8R2so9tcYQi5jPThV3jIz6OOtYPQPcDe R8IDrzM0ewniuY151RTYxg3mblbwquRI/tKz1mEssOH64rtLAaY4SuCdiCUmPqEtYfqA 1shA== 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 x131si1314388pfd.116.2019.07.17.20.08.33; Wed, 17 Jul 2019 20:08:49 -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 S2389449AbfGRDG7 (ORCPT + 99 others); Wed, 17 Jul 2019 23:06:59 -0400 Received: from mga12.intel.com ([192.55.52.136]:49738 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390322AbfGRDGw (ORCPT ); Wed, 17 Jul 2019 23:06:52 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 20:06:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="175892069" Received: from devel-ww.sh.intel.com ([10.239.48.128]) by FMSMGA003.fm.intel.com with ESMTP; 17 Jul 2019 20:06:49 -0700 From: Wei Wang To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com, xdeguillard@vmware.com, namit@vmware.com Cc: akpm@linux-foundation.org, pagupta@redhat.com, riel@surriel.com, dave.hansen@intel.com, david@redhat.com, konrad.wilk@oracle.com, yang.zhang.wz@gmail.com, nitesh@redhat.com, lcapitulino@redhat.com, aarcange@redhat.com, pbonzini@redhat.com, alexander.h.duyck@linux.intel.com, dan.j.williams@intel.com Subject: [PATCH v1] mm/balloon_compaction: avoid duplicate page removal Date: Thu, 18 Jul 2019 10:23:30 +0800 Message-Id: <1563416610-11045-1-git-send-email-wei.w.wang@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes: 418a3ab1e778 (mm/balloon_compaction: List interfaces) A #GP is reported in the guest when requesting balloon inflation via virtio-balloon. The reason is that the virtio-balloon driver has removed the page from its internal page list (via balloon_page_pop), but balloon_page_enqueue_one also calls "list_del" to do the removal. So remove the list_del in balloon_page_enqueue_one, and have the callers do the page removal from their own page lists. Signed-off-by: Wei Wang --- mm/balloon_compaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index 83a7b61..1a5ddc4 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c @@ -11,6 +11,7 @@ #include #include +/* Callers ensure that @page has been removed from its original list. */ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info, struct page *page) { @@ -21,7 +22,6 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info, * memory corruption is possible and we should stop execution. */ BUG_ON(!trylock_page(page)); - list_del(&page->lru); balloon_page_insert(b_dev_info, page); unlock_page(page); __count_vm_event(BALLOON_INFLATE); @@ -47,6 +47,7 @@ size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info, spin_lock_irqsave(&b_dev_info->pages_lock, flags); list_for_each_entry_safe(page, tmp, pages, lru) { + list_del(&page->lru); balloon_page_enqueue_one(b_dev_info, page); n_pages++; } -- 2.7.4