From patchwork Mon Jun 19 17:01:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 9797037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C6E5601C8 for ; Mon, 19 Jun 2017 17:20:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27BAE1FF73 for ; Mon, 19 Jun 2017 17:20:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C6F8200F5; Mon, 19 Jun 2017 17:20:41 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B5C31FF73 for ; Mon, 19 Jun 2017 17:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=U8z1kbNOZg+Nu9Tc8x9K90yH0HRLv8Y9ReBNUYG2JFc=; b=dCZi7jQ8x6FK8+eBZYezd1mjUI dQO/VySVhCOu93aKgZGAR7PBO61ML3CKFKGHW4XCsnwt5v5w89mPiivdLrpFYNE0E6KdtwGRrdPd0 FW21nORqwZWF5Nw2ZvlZNxA/bNN1NN3/9M4m9zwBCCP1A236v7jo+mM1xyFzrCHNGaBy2f+RgxPiw gyHjEoOKyPV28jQmIew6yDl08q1Idl5MjisaFifmVvHAb3L6GZSTga5zvvB5CLv5cphrvHeifO9c1 utCeVmTAHut06HwV99OgF0r0YGm5ZjQO+1eZCloX5HAxIDb9cFeSjUzKt26eradvzm7yy0GV93Cm1 7TK0T0EQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dN0Lu-0008Bl-6J; Mon, 19 Jun 2017 17:20:38 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dN0LJ-000637-2S for linux-arm-kernel@bombadil.infradead.org; Mon, 19 Jun 2017 17:20:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tSoc6jEMhlJmLbW7VOSmmsElUTL6TVtblFGLRZmmEdw=; b=elrahy/0zpRZmJMjL5gn8cgYs CViBY8zrhwzxgozu7YlNPij/qRFwtGlzqjbv858CWV8tT58rAKqQdDCbNlO8ROulyFj9HtPNWWP4C D2WOJJInwYQ+/Tkx7DYQQjykeB7UJrtXW+yVisTUmhIUUQda2wSCMwMyOMwMZqGpHZvIHvVNgWzt7 dO0qyQ82dHFztkl8bIXRY67HxLv3HbpbYDkSIRjdKBLUmYtUrAlYZcCh5qV7Q9rvW277KNauoKAhl vcGTRkbnr/lrirIxcTv2/c57f2tJRv8DAFBqJEwU5xZQwSM2eqE9tkcvxXOUhboIj0B3ylzbqzmqE mH9DNZcdA==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dN05C-0002Z0-B7 for linux-arm-kernel@lists.infradead.org; Mon, 19 Jun 2017 17:03:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7BD01344; Mon, 19 Jun 2017 10:03:06 -0700 (PDT) Received: from localhost (e105922-lin.cambridge.arm.com [10.1.207.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 49CBB3F41F; Mon, 19 Jun 2017 10:03:06 -0700 (PDT) From: Punit Agrawal To: akpm@linux-foundation.org Subject: [PATCH v5 8/8] mm: rmap: Use correct helper when poisoning hugepages Date: Mon, 19 Jun 2017 18:01:45 +0100 Message-Id: <20170619170145.25577-9-punit.agrawal@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619170145.25577-1-punit.agrawal@arm.com> References: <20170619170145.25577-1-punit.agrawal@arm.com> X-ARM-No-Footer: FoSSMail X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-arch@vger.kernel.org, steve.capper@arm.com, aneesh.kumar@linux.vnet.ibm.com, catalin.marinas@arm.com, Punit Agrawal , will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kirill.shutemov@linux.intel.com, n-horiguchi@ah.jp.nec.com, linux-arm-kernel@lists.infradead.org, mike.kravetz@oracle.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Using set_pte_at() does not do the right thing when putting down HWPOISON swap entries for hugepages on architectures that support contiguous ptes. Fix this problem by using set_huge_swap_pte_at() which was introduced to fix exactly this problem. Signed-off-by: Punit Agrawal Acked-by: Steve Capper Cc: "Kirill A. Shutemov" --- mm/rmap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index d405f0e0ee96..feb2352aa95f 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1379,15 +1379,18 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, update_hiwater_rss(mm); if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) { + pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); if (PageHuge(page)) { int nr = 1 << compound_order(page); hugetlb_count_sub(nr, mm); + set_huge_swap_pte_at(mm, address, + pvmw.pte, pteval, + vma_mmu_pagesize(vma)); } else { dec_mm_counter(mm, mm_counter(page)); + set_pte_at(mm, address, pvmw.pte, pteval); } - pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); - set_pte_at(mm, address, pvmw.pte, pteval); } else if (pte_unused(pteval)) { /* * The guest indicated that the page content is of no