From patchwork Fri May 24 09:13:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13672909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579A7C25B74 for ; Fri, 24 May 2024 09:16:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A3E16B00A4; Fri, 24 May 2024 05:16:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62EE06B00A6; Fri, 24 May 2024 05:16:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 261476B00A4; Fri, 24 May 2024 05:16:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D18296B00A8 for ; Fri, 24 May 2024 05:16:36 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 95CA8A098C for ; Fri, 24 May 2024 09:16:36 +0000 (UTC) X-FDA: 82152733992.24.D094410 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf04.hostedemail.com (Postfix) with ESMTP id 257CD40010 for ; Fri, 24 May 2024 09:16:33 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716542194; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AnUx0GHtpqLGFPIKOW2Fk2v1lMR/Tak+U72RaiOw4n0=; b=WVIbKMvLW0Tm5MZ4GkYFOCNeYvPz/ca07fHvE302S03zvA37LhV8T927b1aOjHPBSyOt2B bKl/EX6AaiDu7S0kbvCEEGTaomsjNq8wwrfajdLG4vkj11md1Z3Ie1lLMEYZ+WrPRF9ql/ k4xbWN5kd3ocwyIFB5QCLWbEvxtTJ7s= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.35 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716542194; a=rsa-sha256; cv=none; b=MdkOon1GrURlnOh6DSX/b9oQsrJBveif23SXlYKqyQ0m0GzTR7H0cmrULwzzazNL4zTPPE bORB0FoheZ2GQZlpqdZ3zCXZ4esOAUACyXdElCAspYRdVho6DiIMuXkEU5erC6XDxTBtDP Y8Sz5dLKji4hmKENPBZu68jy6LactJU= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Vlzph0Cgyz1S5bv; Fri, 24 May 2024 17:13:00 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 10C4F14037C; Fri, 24 May 2024 17:16:31 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 17:16:30 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH 10/13] mm/memory-failure: move some function declarations into internal.h Date: Fri, 24 May 2024 17:13:07 +0800 Message-ID: <20240524091310.1430048-11-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240524091310.1430048-1-linmiaohe@huawei.com> References: <20240524091310.1430048-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Queue-Id: 257CD40010 X-Stat-Signature: kg8un4k5rz9ucuikh8boqynkbopffnq9 X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1716542193-63992 X-HE-Meta: U2FsdGVkX1+ZWXSpm9grl7GpT4Im+ZQ2yLugCsJR/FxPobe9f2cc5iVhQufP+1xvuvbyikZq84aSSpeYP2siDoRQZH4m/Gh980FO2y39KmSwCP/CVPwZPmpoHmrZ6AemcdFQ403LESh97fxB7nsTu9RbggzQlCQcsR2WZ/uuYVsLUkdNcSuw56E4ZM5VvaRbnmnhEeyaXQNl2yGgFWd8hnRBvKUQYhKmC/lXGeZKyHklfdt2kp68XUDP4FZ5Bw3vf5VjiIMWcP9/+WBxGBrH5NjOnsZRgxDc13dvK8WhbQ/GiWaApw2flMFJIJq3CHOlQxnP6fueAB5dIQ1U7xAPtMJmJxjgaVC/hJaRETlKt3LbX50qh073cWKgg+Wz6SsxKCP5GLuBLgUrM2zzI02dKnUTDizfaffzq7BHztVwKbvcV6ebP13PQmsi78MmodwlR0Vo7/dly3o1fFJeq3xDcj84RSaCkCD19DVUcUDJ2YaI5AaskX3IKZqLAKp0DrDIfmzhHOMKbEWctMYVrOvG1ohI2KeNyJCyFkOP+y7amPnhuZGEcNLKrxBKzydagxhv7mQaNliNheCY7rhiU9k12OBlm08m3SQdQJ07rlZSCka1EFgsmSv13DauxlPs0B5BDLPDtqXbrcmimdJXtNe+thCUCveA7hMm2fB4E+urj9r73EEyp5P1NM+zSZE1D6ABA+ge6wyfqnkzmLie7/erqdU5RF5+WoTuzxYkUBaYL79J+YzMe7wTvexDMi6cSFnB+L78lFY1tiuR9bMPij0cL89DSXFPLS1Leindb9vq8C2F0Lyg3iEGm0VMCMvI9y3EGo6thsb9vTwcYNPJkhQ2gA1FToq5jQ+s3XAdizWzfJdofk4w1Ibk9K61LZpsTTERI6YSDJW0XXlNF+MbT9cY8m8zWtnGjO3TLfUb8fhCLkOmDfRddg5Xdr3tL/akkPyek2A/UX/tSnAs2nMDQDX F7eXeo++ tjBe6OfGUfLJI2HS24P7T+FWF71yUSZBFHUgPyqFfrygMAl2gV0tdAVfHzNu95tUiTrZ9pY4/wHlvWS1grfCcMH6ROyO7q9QNMgzDR5OcPSvTZ1D3pnUl12gp+m4hF1kLkEo/FIUeLT1yqX5RyVER6Kz32LUGu0F2ZZ+MwF8IN9O2Xt1AXWRriFKe7MbUYc6gf2oLwyUzYKvdowWZm9FzCZRwSQ== 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: List-Subscribe: List-Unsubscribe: There are some functions only used inside mm. Move them into internal.h. No functional change intended. Signed-off-by: Miaohe Lin --- include/linux/mm.h | 13 ------------- include/linux/page-flags.h | 5 ----- include/linux/rmap.h | 2 -- mm/internal.h | 16 ++++++++++++++++ 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 4bc97ae25ade..d5174b3b792b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1330,12 +1330,6 @@ static inline unsigned long page_size(struct page *page) return PAGE_SIZE << compound_order(page); } -/* Returns the number of bits needed for the number of bytes in a page */ -static inline unsigned int page_shift(struct page *page) -{ - return PAGE_SHIFT + compound_order(page); -} - /** * thp_order - Order of a transparent huge page. * @page: Head page of a transparent huge page. @@ -4032,7 +4026,6 @@ extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); void num_poisoned_pages_inc(unsigned long pfn); void num_poisoned_pages_sub(unsigned long pfn, long i); -struct task_struct *task_early_kill(struct task_struct *tsk, int force_early); #else static inline void memory_failure_queue(unsigned long pfn, int flags) { @@ -4053,12 +4046,6 @@ static inline void num_poisoned_pages_sub(unsigned long pfn, long i) } #endif -#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_KSM) -void add_to_kill_ksm(struct task_struct *tsk, struct page *p, - struct vm_area_struct *vma, struct list_head *to_kill, - unsigned long ksm_addr); -#endif - #if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG) extern void memblk_nr_poison_inc(unsigned long pfn); extern void memblk_nr_poison_sub(unsigned long pfn, long i); diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 104078afe0b1..00c33a6ea367 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -616,11 +616,6 @@ PAGEFLAG_FALSE(Uncached, uncached) PAGEFLAG(HWPoison, hwpoison, PF_ANY) TESTSCFLAG(HWPoison, hwpoison, PF_ANY) #define __PG_HWPOISON (1UL << PG_hwpoison) -#define MAGIC_HWPOISON 0x48575053U /* HWPS */ -extern void SetPageHWPoisonTakenOff(struct page *page); -extern void ClearPageHWPoisonTakenOff(struct page *page); -extern bool take_page_off_buddy(struct page *page); -extern bool put_page_back_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison, hwpoison) #define __PG_HWPOISON 0 diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 5cb0d419a1d7..ece0515ee21c 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -733,8 +733,6 @@ int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff, void remove_migration_ptes(struct folio *src, struct folio *dst, bool locked); -unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); - /* * rmap_walk_control: To control rmap traversing for specific needs * diff --git a/mm/internal.h b/mm/internal.h index bbec99cc9d9d..188e292d2a77 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1061,6 +1061,22 @@ extern u64 hwpoison_filter_flags_mask; extern u64 hwpoison_filter_flags_value; extern u64 hwpoison_filter_memcg; extern u32 hwpoison_filter_enable; +#define MAGIC_HWPOISON 0x48575053U /* HWPS */ +extern void SetPageHWPoisonTakenOff(struct page *page); +extern void ClearPageHWPoisonTakenOff(struct page *page); +extern bool take_page_off_buddy(struct page *page); +extern bool put_page_back_buddy(struct page *page); +struct task_struct *task_early_kill(struct task_struct *tsk, int force_early); +void add_to_kill_ksm(struct task_struct *tsk, struct page *p, + struct vm_area_struct *vma, struct list_head *to_kill, + unsigned long ksm_addr); +unsigned long page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); + +/* Returns the number of bits needed for the number of bytes in a page */ +static inline unsigned int page_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long, unsigned long, unsigned long,