From patchwork Wed Feb 9 09:41:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12739929 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 E01E9C433EF for ; Wed, 9 Feb 2022 09:42:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6507C6B0074; Wed, 9 Feb 2022 04:42:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 600016B0075; Wed, 9 Feb 2022 04:42:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5169D6B007B; Wed, 9 Feb 2022 04:42:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 437866B0074 for ; Wed, 9 Feb 2022 04:42:19 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 020BD96F26 for ; Wed, 9 Feb 2022 09:42:19 +0000 (UTC) X-FDA: 79122750798.20.F3471DA Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf21.hostedemail.com (Postfix) with ESMTP id 7F5831C000E for ; Wed, 9 Feb 2022 09:42:18 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6016EB81FDE; Wed, 9 Feb 2022 09:42:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4EA0C340E7; Wed, 9 Feb 2022 09:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644399736; bh=T+mYubC4DgSvWYTBn4SckuteBDQWitfpW4vxCFz9Xd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t17a+03WpPX5fsyUkiVTqQQb7z0JMhqNvZlsnI+WEPj7FkoPewMVPVXjflLcg9EE9 GsHvy14RTTWBaoF2mawz3tHmklfaoojB+PysLINwOETeXVm84mCSMlG1FAA3H1snEd nugn54oDNGmkwczq7cQREbfICXYt2kEMFIPGXxp7oCH1Guz/yDneb7XqNTO6Uafq7e rNE8DkCmHqu+OtgKl/G87Riq5oSpyI+VbyTr90CKlW6dcJ5nASv8Z9sBw9M6xPPmIu PCEcpl30FDfNoqir6Up3C785j80M0mbJwjo+50juCR7xJouMdlDWZlZnHOCcJAgyjq hq4lCIIWCdeIw== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park , hughd@google.com Subject: [PATCH for-mm 1/2] mm/internal: Implement no-op mlock_page_drain() for !CONFIG_MMU Date: Wed, 9 Feb 2022 09:41:57 +0000 Message-Id: <20220209094158.21941-2-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220209094158.21941-1-sj@kernel.org> References: <20220209094158.21941-1-sj@kernel.org> X-Rspamd-Queue-Id: 7F5831C000E Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=t17a+03W; spf=pass (imf21.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: 7p1cr7996ikgcy7irnji9gyqm7peu9nt X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1644399738-995687 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: Commit 4b3b8bd6c8287 ("mm/munlock: mlock_page() munlock_page() batch by pagevec") in -mm tree[1] implements 'mlock_page_drain()' under CONFIG_MMU only, but the function is used by 'lru_add_drain_cpu()', which defined outside of CONFIG_MMU. As a result, below build error occurs. /linux/mm/swap.c: In function 'lru_add_drain_cpu': /linux/mm/swap.c:637:2: error: implicit declaration of function 'mlock_page_drain' [-Werror=implicit-function-declaration] 637 | mlock_page_drain(cpu); | ^~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors /linux/scripts/Makefile.build:289: recipe for target 'mm/swap.o' failed This commit fixes it by implementing no-op 'mlock_page_drain()' for !CONFIG_MMU case, similar to 'mlock_new_page()'. [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-munlock-mlock_page-munlock_page-batch-by-pagevec.patch Signed-off-by: SeongJae Park --- mm/internal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/internal.h b/mm/internal.h index 0d240e876831..248224369b34 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -508,6 +508,7 @@ static inline void mlock_vma_page(struct page *page, static inline void munlock_vma_page(struct page *page, struct vm_area_struct *vma, bool compound) { } static inline void mlock_new_page(struct page *page) { } +static inline void mlock_page_drain(int cpu) { } static inline void vunmap_range_noflush(unsigned long start, unsigned long end) { } From patchwork Wed Feb 9 09:41:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12739930 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 E672FC43219 for ; Wed, 9 Feb 2022 09:42:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 602716B0075; Wed, 9 Feb 2022 04:42:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B1F26B007B; Wed, 9 Feb 2022 04:42:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A1556B007D; Wed, 9 Feb 2022 04:42:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 3CCAF6B0075 for ; Wed, 9 Feb 2022 04:42:21 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ED389182067A5 for ; Wed, 9 Feb 2022 09:42:20 +0000 (UTC) X-FDA: 79122750840.14.0911A86 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 91C23C0003 for ; Wed, 9 Feb 2022 09:42:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7D27619B6; Wed, 9 Feb 2022 09:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A61F4C340E7; Wed, 9 Feb 2022 09:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644399739; bh=Hj4guPRHDf34ilQhSL4H2ZHu0uoUXzIKahEM2dGbhc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBIiEUglGNaozi8wCk7JEHogC+s6n2oGOegdedQLT58ZmDH4oLBynvio9o6Z9Hke7 H3C1fXPgBPsynjoLfyixntDZb2Zrvj4+mp0US991qnja3Z19YxJyn95o+QD/ZHoCuK OH5ayPgSRzULSPTnUjTnBChmgu03SeV6jIo49U/zRfru8G7UItNu+/Gm/Ozvkb3uX+ TbSMW/+uLI8ryzHRee4iD8ZuZ+3XVhQWV7fHJ/11caNrAopel4SD63Ehw3BSKb2uac ssBzq4/0eax4rwqbOICH8md5mUX/em9RC7gI1DiC+tS3ETTojG0nhulpd5P13nvZwp vTKgxCQSSxpjQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park , apopple@nvidia.com Subject: [PATCH for-mm 2/2] mm/gup: Make migrate_device_page() fails always if !CONFIG_DEVICE_PRIVATE Date: Wed, 9 Feb 2022 09:41:58 +0000 Message-Id: <20220209094158.21941-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220209094158.21941-1-sj@kernel.org> References: <20220209094158.21941-1-sj@kernel.org> X-Rspamd-Queue-Id: 91C23C0003 X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=dBIiEUgl; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: wq719ebd68wxbkkj5thpo1xts8qpmpf4 X-Rspamd-Server: rspam04 X-HE-Tag: 1644399740-729534 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: Commit 7059ac82be44 ("mm/gup.c: migrate device coherent pages when pinning instead of failing") in -mm tree[1] introduces 'migrate_device_page()', which uses several functions that defined under CONFIG_DEVICE_RIVATE. As a result, build under 'CONFIG_MIGRATION && !CONFIG_DEVICE_PRIVATE' fails as below. LD .tmp_vmlinux.kallsyms1 mm/gup.o: In function `migrate_device_page': /linux/mm/gup.c:1856: undefined reference to `migrate_vma_setup' /linux/mm/gup.c:1876: undefined reference to `migrate_vma_pages' /linux/mm/gup.c:1879: undefined reference to `migrate_vma_finalize' /linux/Makefile:1222: recipe for target 'vmlinux' failed make[1]: *** [vmlinux] Error 1 This commit fixes it by implementing an always-failing version of the function for !CONFIG_DEVICE_PRIVATE'. [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-gupc-migrate-device-coherent-pages-when-pinning-instead-of-failing.patch Signed-off-by: SeongJae Park --- mm/gup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 1df99a5e90cf..0cf59858114d 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1834,6 +1834,7 @@ struct page *get_dump_page(unsigned long addr) #endif /* CONFIG_ELF_CORE */ #ifdef CONFIG_MIGRATION +#ifdef CONFIG_DEVICE_PRIVATE /* * Migrates a device coherent page back to normal memory. Caller should have a * reference on page which will be copied to the new page if migration is @@ -1887,6 +1888,14 @@ static struct page *migrate_device_page(struct page *page, return dpage; } +#else +static inline struct page *migrate_device_page(struct page *page, + unsigned int gup_flags) +{ + return NULL; +} +#endif /* CONFIG_DEVICE_PRIVATE */ + /* * Check whether all pages are pinnable, if so return number of pages. If some