From patchwork Mon May 22 13:36:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Punit Agrawal X-Patchwork-Id: 9740529 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 74DAE601C2 for ; Mon, 22 May 2017 14:06:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6509E27861 for ; Mon, 22 May 2017 14:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 595B72867E; Mon, 22 May 2017 14:06:26 +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 385AD28650 for ; Mon, 22 May 2017 14:06:24 +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=JHsYE25e648m7XMS8+yz7nvqbX 8ZGAFSS2PPGK71uGuaDUNkAecWT6vreBfSJ4D/FcUmY5HroVBB9Gd22gFegCUYI/Ij10HeuxWRJNX P3iCXjbdJxyCSrByKwraNkbs0BMGHOtzJhIScokbFZTKWfSC2kajJhfzBcd3TRGPKRarICdPef8aU hdKxwLxEHQnFz7ggxF7lE95vDS+I0c4gal198rHiZkequnNgbZTdhC5T40HOUvzJCfUepSZdo3uc7 z0LO1RchLdxvdSVB2ExeYLilfuG2d+cn7mRwgH9xjKAnyzbXStqykybOdv1ulbTLUGahFUfxw6QkQ 1Gf4hmfA==; 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 1dCnyZ-000295-EV; Mon, 22 May 2017 14:06:23 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dCnvG-0005hc-5f for linux-arm-kernel@bombadil.infradead.org; Mon, 22 May 2017 14:02:58 +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=rSqdpoUPmKYGzwuYDVe/Yzn1B as+V7Y93kSIyEZIdthh1XP2UtxF6gUlJPgKJd8EPMyUhHV0ONBXcwUKY7u7yLDV16bG/vmxZuwuPO GnenFkLgoxJEMDY714Byq1CeaEw8g9kOh8nEcNa5lT4xBg0dYsG4BkY7eHpAValH8UMgUy6CTsKtU gJwmmoqdrxZvJh4gPM8LrEJYr3ME02mhNuyW4KY5PsbRs1d72ISGAEsEoEOK0isMuVdFkxs/NZQv4 PXIfzndipL2hP3Z6RpVMZZC65F3JBwEjtAAQBpfRXaByQTtzW2NB+A4292i5M/hWMkqpuTlPrOC5G AEB/ZR/Aw==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dCnWh-0006tg-92 for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2017 13:37:35 +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 10FDD165C; Mon, 22 May 2017 06:37:18 -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 D3E683F53D; Mon, 22 May 2017 06:37:17 -0700 (PDT) From: Punit Agrawal To: akpm@linux-foundation.org Subject: [PATCH v3 6/6] mm: rmap: Use correct helper when poisoning hugepages Date: Mon, 22 May 2017 14:36:04 +0100 Message-Id: <20170522133604.11392-7-punit.agrawal@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170522133604.11392-1-punit.agrawal@arm.com> References: <20170522133604.11392-1-punit.agrawal@arm.com> X-ARM-No-Footer: FoSSMail X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170522_093735_408813_F1953F14 X-CRM114-Status: UNSURE ( 8.41 ) X-CRM114-Notice: Please train this message. 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, hillf.zj@alibaba-inc.com, 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