Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp444387pxb; Fri, 16 Apr 2021 09:17:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzha3N4AjYi4rh2QkgegMU1PDa8FbL3zR2bcLd0srnJAO4qUSfg74cqaM9g+7/1Sq3p+KO X-Received: by 2002:a50:9feb:: with SMTP id c98mr2796742edf.104.1618589866965; Fri, 16 Apr 2021 09:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618589866; cv=none; d=google.com; s=arc-20160816; b=Xc51o44wq8eXxJxTxXwC0cs6Wkar7CJwT8a2+XX3jZSFwVOHgTIHIl1Azf4YurdkBu 5dY+GrETyvENouIy6xFK6QV1XzMtyoyibwN2tarNxou28pSIMJWIMt6XEmsLERHufpcB cbOtuCUdas5PW8fIpR4R4o4mRiosad+t15Y7LlqgVVBBBG0EZZGAh7P4qdIl7OIQuL2K tX5i2LZz0QSB3X+koiFSvx5xjMmQmVrtlXXq4FsT+rZT09UCuVyb1IjE6/CSlArZhEVz PcLEWWzweerJqVe/oVDlT//mhoQKW6yQf8fw812kNcaxqObQSLObIDtdPyL4BZcMgfpr Qddg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=O0t6xpRiqFatLBm+HO9lCt78jk3FTsdBC5/K03KCJ1U=; b=dP+EX08FKc5MYyg4vn3WMCCFXmsbGZhGyZB/p6GfgQeV1Ty5j1KBsh9hV/jZYy96Pt w0L0XHAG/TDN+yw988FvgJXcOd4WjDj9FOfPkNOd6a/onFa9YMfXId8jKQy9olRQEFsJ NAQpCnyAwaB0qwu9H2pUisDCy5QVBPboi4ruqBWtN/sXtEUi/7HjF3MKzsQeAtJXMuoW +ajhL00L6jSGVw/fo/sCD+fqblclJ2Xxh5xNicPaKSKLqqyyzcMqYjcGzEQ6L8HwqZzq yxGUGbFzNOWASxB+kKH7HYrIijT7MXKCWgV30BGQE0MXS3mDiYLdmD+JmSGpJoAfeOEK i4Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k13si5233010ejg.416.2021.04.16.09.17.23; Fri, 16 Apr 2021 09:17:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1343999AbhDPPmT (ORCPT + 99 others); Fri, 16 Apr 2021 11:42:19 -0400 Received: from mga17.intel.com ([192.55.52.151]:10800 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343970AbhDPPmI (ORCPT ); Fri, 16 Apr 2021 11:42:08 -0400 IronPort-SDR: uWHD7F5t2HzlTcto9mPtvJcDEq9sES5hTS581oUnaruuGCDkBRGkG43VurwDmUL8y3VJxymj3J 1XinxyK2Ceyw== X-IronPort-AV: E=McAfee;i="6200,9189,9956"; a="175163936" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="175163936" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 08:41:43 -0700 IronPort-SDR: lGuaSt9Jbppuno2GL+IX51ChFHPEI5DU+6ronyLCHnvyol9GOMLKa/g0sci/4syDwSpPwbuOAE o2DRvdX+WXuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="422038783" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 16 Apr 2021 08:41:38 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 144FD2BE; Fri, 16 Apr 2021 18:41:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , Jim Mattson Cc: David Rientjes , "Edgecombe, Rick P" , "Kleen, Andi" , "Yamahata, Isaku" , Erdem Aktas , Steve Rutherford , Peter Gonda , David Hildenbrand , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [RFCv2 07/13] mm: Add hwpoison_entry_to_pfn() and hwpoison_entry_to_page() Date: Fri, 16 Apr 2021 18:41:00 +0300 Message-Id: <20210416154106.23721-8-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210416154106.23721-1-kirill.shutemov@linux.intel.com> References: <20210416154106.23721-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add helpers to convert hwpoison swap entry to pfn and page. Signed-off-by: Kirill A. Shutemov --- include/linux/swapops.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/swapops.h b/include/linux/swapops.h index d9b7c9132c2f..520589b12fb3 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -323,6 +323,16 @@ static inline int is_hwpoison_entry(swp_entry_t entry) return swp_type(entry) == SWP_HWPOISON; } +static inline unsigned long hwpoison_entry_to_pfn(swp_entry_t entry) +{ + return swp_offset(entry); +} + +static inline struct page *hwpoison_entry_to_page(swp_entry_t entry) +{ + return pfn_to_page(hwpoison_entry_to_pfn(entry)); +} + static inline void num_poisoned_pages_inc(void) { atomic_long_inc(&num_poisoned_pages); @@ -345,6 +355,16 @@ static inline int is_hwpoison_entry(swp_entry_t swp) return 0; } +static inline unsigned long hwpoison_entry_to_pfn(swp_entry_t entry) +{ + return 0; +} + +static inline struct page *hwpoison_entry_to_page(swp_entry_t entry) +{ + return NULL; +} + static inline void num_poisoned_pages_inc(void) { } -- 2.26.3