From patchwork Mon Dec 11 16:22:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13487532 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 C3D42C4167B for ; Mon, 11 Dec 2023 16:22:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68C916B0157; Mon, 11 Dec 2023 11:22:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 616346B0158; Mon, 11 Dec 2023 11:22:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43FFA6B0159; Mon, 11 Dec 2023 11:22:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2D70F6B0157 for ; Mon, 11 Dec 2023 11:22:28 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 03BE0C06AB for ; Mon, 11 Dec 2023 16:22:27 +0000 (UTC) X-FDA: 81555055176.30.F7ADB57 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 2472B140010 for ; Mon, 11 Dec 2023 16:22:25 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bBdnAJaG; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702311746; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iBAETAIC6DR0PILlxhyqfKzerc8Q362OER7xGl6qcHk=; b=uiR4VnGKQ+2aXBuj67TkOu1DN2s3plYja21mZMXYZWk1zNMKm08MSA3RYWIwkyX22pZExy HewjhPhnGveuSQyUPa+zqm3bbwOdge76v6q7dX0JJ4rNUo93qoPEUxgptbl+WyuZguXwkM qxb3vzPi2f2vmbk/2oWlRxhaXSotUmM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702311746; a=rsa-sha256; cv=none; b=A9xPRDvW/3+HYE+xijjh9LQTdnuY/nh9WktgIeV+s+vC+ORL8DPxlKuhtYu8KMvPCP4lVu pZRXo9DwogoVQHZDN0OBOaEHvkMtM6ckE2NLsAa2jCM5o8bBb5U3K+PghqnefvWl2pRv7d MrmF+4WYjcSPUljIBYfIKw2qGUri6B0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bBdnAJaG; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=iBAETAIC6DR0PILlxhyqfKzerc8Q362OER7xGl6qcHk=; b=bBdnAJaGRNMzhe8VwT1bFm6SQm EqG640irRvkB0L6v367hdLPLmHWIB+KRtRTtP8Y+HnJ0qhGZcBKciyG6vnormZARZIKAeNVM8RnvQ o4G8K5RVGg3nhy7wloy8mzQiPOu4eEQ4bl7FQ927u4VfaMIFyUmnpAmei52HoQgABBN4SAglXU+dM Minu2xIY6K/3ivUc9/r9Rdw4MHAF5ZYZl+k9iXDLOEzddK6UJ7Maq0vIOsvnqwbHl4Y/CFCub0A2/ HENGh3zRKjKYK1qEcqlpOocgxPcJH7xlZnjeR5EclmvgeskfSU0UUCoFLNbEuoMfm908IMUO0NsNQ g+tY8U8A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rCj2u-0090JL-3v; Mon, 11 Dec 2023 16:22:16 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 2/9] mm: Simplify the assertions in unuse_pte() Date: Mon, 11 Dec 2023 16:22:07 +0000 Message-Id: <20231211162214.2146080-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231211162214.2146080-1-willy@infradead.org> References: <20231211162214.2146080-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2472B140010 X-Rspam-User: X-Stat-Signature: i5wqyezqsxhx9u1rjut8cs1o48351jib X-Rspamd-Server: rspam03 X-HE-Tag: 1702311745-75239 X-HE-Meta: U2FsdGVkX1/igerGxwKY8ocVPQczKgPzpvVzyCRq6z5XVQqD1DyVeEkOjE+ohOMV0mbE1UHFvTQqkAfEr/HYZLg+zZx8XkXfMaf97SwgJ+4QNyfUnbQSVZwtqi9lCqn/G3nJmI1V4QVBgrCerlyeewXpkUpIiiBuvR0a8YoZwBXs48YM6XaC/CQ3RG3fMxTd0Hh1oyXzkeXhoLl9enYAhSAMkYZvf6PvJseJns/f2eBdkjWIRfFkUEc/nFy1FTjkZ0pcucH2bPKwewzJri+iG6l99CzvTTBEloWjJxXTb5bRZLFuB+th7cA8rS93Y1F78qnvOzooRkQRdHdFCjmprhrk5K/puAo3DX6IRCvQknsnd0MlueBXIf9c35q2C74ZiCwLyTx16BhcUE9SD58JFShPG7A3OJDeBQUr3NEevTT6opC+jNGcvqd4nrW2TuP8Dx17UrTpH5grhAB7/jTiylj3FLntGfdk7kC6HrEG6wb3aGkFdbQcf8+P3n4tw9uq4KjRMolexMc3ff8HybPQE/SZMXNbetIy8eTv83i87ZkhU+9va63GqMMTiaPbft/xD30kcn4nR87MZvu8bJ79v2xfnSJCzbgWIiYQL62e9M5TxyHGENz06qCNnj3A/xY3nFh8fak/JZt9M/N8A624ueBhlLM3FLMnBrMVpeRiuMVHfx1JkYSkWjWT1DRe72y/vIMoxZXyJYIBKHJK9U0yJ6GtJ/5ggWOOHkDzcxBNFcuAC92p10YVA0fX81O5/MJPCsQgI+UF9tiHYS7CcXaqHhukhmQ4ahFmgrdoL9aD+3DAO7dEV/dwNS+3tLF8Dd+SAxs9rMdMIYwwUhJ5Tnc45t4RW2G+0OwvoLl93we5NWvH2KosGF29xMa46/dL8SJGMt3uUUNBzsJaW5XOMENm3FLzgg/Es4ujz/IYnET2kLwHozzVD3yjm/W96R1e2YSf8aAU1NgvOPzB6qG3b8t ljn6btyA i6dO6rd0IZx0Uxl+8OMvXJDFsAFDDyHIs0hhatfF5+Qjwv6XTOH9uBDtp/6TQG0iUyEkCtje4ORz7N8IjqBTdhog9apl6Gjx7UqYHm4EQpWjR5sUSu6XV+O3aoCI0/Jaaswvp8UAt/ayjUfsYZUYAWzb6MjnDOreFjsTZg2TUaYIE4lUBVTZOsz9z2sbQOI3BOdK8W6e+hASh990nTzxVVFfLeOYGcCYsk4tt 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: We should only see anon folios in this function (and there are many assumptions of that already), so we can simplify these two assertions. Signed-off-by: Matthew Wilcox (Oracle) --- mm/swapfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 0371b7b3cd27..88842c6fb8fe 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1789,8 +1789,8 @@ static int unuse_pte(struct vm_area_struct *vma, pmd_t *pmd, arch_swap_restore(entry, page_folio(page)); /* See do_swap_page() */ - BUG_ON(!PageAnon(page) && PageMappedToDisk(page)); - BUG_ON(PageAnon(page) && PageAnonExclusive(page)); + VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio); + VM_BUG_ON_PAGE(PageAnonExclusive(page), page); dec_mm_counter(vma->vm_mm, MM_SWAPENTS); inc_mm_counter(vma->vm_mm, MM_ANONPAGES);