From mboxrd@z Thu Jan 1 00:00:00 1970 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 A62FFC021AA for ; Mon, 17 Feb 2025 19:08:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B1B628008A; Mon, 17 Feb 2025 14:08:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1ED41280085; Mon, 17 Feb 2025 14:08:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0646928008A; Mon, 17 Feb 2025 14:08:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D72C8280085 for ; Mon, 17 Feb 2025 14:08:47 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8AE364BEA7 for ; Mon, 17 Feb 2025 19:08:47 +0000 (UTC) X-FDA: 83130373494.21.1B0F1D8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 0CDB840013 for ; Mon, 17 Feb 2025 19:08:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Jz34MUBk; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739819326; a=rsa-sha256; cv=none; b=AMqD6Um8XiFmYZBtS9SLBv+lOisUtOZYdeNA7Wq5JJ+0PBsSeuUCzOo86LPeWEBI0RdJ5t OrNy/3/F2Fj89uv2IIDUY2+Y+oZf68c/QXThyc5hyPCBC9tuT66qE+oN2CEFgecM+VFOG8 CXogtDTA/3OKOD5m4Ex1NOQy/6bNLZU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Jz34MUBk; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739819326; 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:references:dkim-signature; bh=xPK3eVt9+7xzyAPyUDSt55ICTTIrX4D95c1avul6TRk=; b=ZyV80NTffGOnTLQ45udtHk4XPxZTwPGm9/h2RxrQcphyFtGlKf9T2Ygvny1xanOb2G0cS1 hu1x1eM3iPcuhz4CSXi+eQlqlmPwdCGOMkuXDY9FeirGtJN7I1KySzwC4LjsWoyGGU1dAY LCWY26cDepHwZgdqFPmPmeiDF78Hg6I= 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: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=xPK3eVt9+7xzyAPyUDSt55ICTTIrX4D95c1avul6TRk=; b=Jz34MUBk12WoNx3nG8DYnhoKOG 5TdzeRiHmtpKkxk3YXdh4WT9xz/u9O9dg4xXajm73CZ4nwIf4hXUUIxmUVzFDLLEyA49LyHVhFg/9 jU6cGlj48Pp3AWlNkp0kOGJcYR/oBWOnJAzuGrKSBapUz5885RV7u33SS6rGZosC/WoLJ7AznBLb/ EZvh5DXpj7mTNzZeCv/ZM98Mo2dpj/YL54x3ceiSxdjzRgT8zbBhqErxpxXc0wRy2tCqrBVz6bvp+ cPfmrAjIb2VvaLUmvPF5AYOczpX9oO0vXS9N0GfX3WQ14h4ExIX+z2eRJHTarDPAnImAruOehyCzZ 6W7zMzMw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tk6Tu-00000001pBB-2EX9; Mon, 17 Feb 2025 19:08:38 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org Subject: [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte() Date: Mon, 17 Feb 2025 19:08:27 +0000 Message-ID: <20250217190836.435039-1-willy@infradead.org> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: 0CDB840013 X-Rspamd-Server: rspam12 X-Stat-Signature: jpnicsmys9zbusmjcfgbk8j17mqgeujg X-HE-Tag: 1739819325-261484 X-HE-Meta: U2FsdGVkX19/CXU6MzGYaa7+BKIpdrisijxBVIas3fjeGUmTc0DPEVGAzPIVbTnD0anijESGG+CYiSEaKjSj3USqF1dAnJFrwVdgYs2gRsH9a/q2ifg60qkfZU88euDel6Vh+yp1kcuQaPI+SE8pMh6P0S6lfT2plVuIPD2b9G6S+qc+zJSfXbzXZRI6J1ju9JHEMHZNpejXgdhEkNYprKw/Dc+PlT7ZYkPi5n8K682eQ5Mwns4nIjMR0o13UZ64NwGIDVXEX/3Dg/F2bvKbBbbtlSP8FJZU2TBax843pOdIgWKy2VtFNRxGFJpKrWsHU8CGmV5O0ML1gE3gOlRu+UHdXPtJg89XQyrW62ReN6Jmbae+tQruiZh3+C0UiNHIhvDrEy869P994HyNhjxKMP3ndfAyyfQjIgRZco4Jy7GZxDhz6j2qmKqXWGbsipCAzOSNAtbyCemS11ovYBG0FOXiXCaXXnHAiCkV5koFytlSvu7xnxMX1LT6hzhVJ7jp1XwRASFcw0aj5Bo/TWpWQDlME0ppsGio08ir1ysuweKC5Bj8XE4OSp+Zi+cvJ2eQO1DSCwbh272JNhoDhfHsahcCC4kgqJJWbgXH90SdD1aOv7aGr+IMOJCF54or2cr3F8a6z4kxBCsDmf0ssbvUx+/qjsHBvXzPAszT11jm4zSuhkgBP17lt3mO55ogkJHO0Wqf3B9bFqQPI3Nl4mICSwekedC6JTTLIrk8EINgd6/vSUmLW0+lZqewHsgSmB8fDCa8Upjbtjk+R4HKvGWPKzRPG7azJFSWD+0jmzno0N3eRLoGIvfzyeC3U4k7MngUC0EMzpMAyyeXGHaIAc6hzWdyrEBEfgQO12QyXt2G+MUrMB2O9uODYGP0JSXGBjHC9VHUl2VFyRkKnv0ScpMn/i7JbeKdXcywGcu6v4+y+WVoUoJr7UQFqfbtpFJhxgXf7BxMOL/wagCV35mII8E N9UahmHP lgIr8VkAEIHFxaRFUjL8Re+uSk8OdkUfKYKx6t9SnH9LIb3QIRzUa5tSzmRXIZ+XyMlV4tU7caLdprHgrFgXOS5NzDxWGdjzcYTQW0ae59Jx6XIlo21nIyLJIy9QUlcGbEuDKHo9hx3RJmB0gDWvfZMMBhevBgF5/ebZ4Ye5R04MsNyyLMMZVdfOEKgbdKnuXr8n+5l/kB7zgRqS3tQNA3ZMSju5XzRuuXMfReikgBnBOqR+sJTUU3s3hG3xk9kXRxb77SUS8CEn7omSFy+/AwniI/NFSqbXY8zso X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The intent is to add folio_mk_pte() to remove the conversion from folio to page necessary to call mk_pte(). Eventually we might end up removing mk_pte(), but that's not what's being proposed today. I didn't want to add folio_mk_pte() to each architecture, and I didn't want to lose any optimisations that architectures have from their own implementation of mk_pte(). Fortunately, most architectures have by now turned their mk_pte() into a fairly bland variant of pfn_pte(), but s390 is different. So patch 1 hoists the optimisation of calling pte_mkdirty() from s390 to generic code. I'd appreciate some eyes on this from mm people who understand this better than I do. I originally had - if (write) + if (write || folio_test_dirty(folio)) entry = maybe_mkwrite(pte_mkdirty(entry), vma); and I think that broke COW under some circumstances that 01.org could reproduce and I couldn't. The various architecture maintainers might care to make sure that what I've done is an equivalent transformation. x86 was particularly tricky. The build bots say it works ... at least now I've dealt with the pesky !MMU problem. The last patch to actually use folio_mk_pte() ought to be the least likely to have a problem since it's equivalent to calling mk_pte(&folio->page). Matthew Wilcox (Oracle) (7): mm: Set the pte dirty if the folio is already dirty mm: Introduce a common definition of mk_pte() sparc32: Remove custom definition of mk_pte() x86: Remove custom definition of mk_pte() um: Remove custom definition of mk_pte() mm: Make mk_pte() definition unconditional mm: Add folio_mk_pte() arch/alpha/include/asm/pgtable.h | 7 ------- arch/arc/include/asm/pgtable-levels.h | 1 - arch/arm/include/asm/pgtable.h | 1 - arch/arm64/include/asm/pgtable.h | 6 ------ arch/csky/include/asm/pgtable.h | 5 ----- arch/hexagon/include/asm/pgtable.h | 3 --- arch/loongarch/include/asm/pgtable.h | 6 ------ arch/m68k/include/asm/mcf_pgtable.h | 6 ------ arch/m68k/include/asm/motorola_pgtable.h | 6 ------ arch/m68k/include/asm/sun3_pgtable.h | 6 ------ arch/microblaze/include/asm/pgtable.h | 8 -------- arch/mips/include/asm/pgtable.h | 6 ------ arch/nios2/include/asm/pgtable.h | 6 ------ arch/openrisc/include/asm/pgtable.h | 2 -- arch/parisc/include/asm/pgtable.h | 6 ------ arch/powerpc/include/asm/pgtable.h | 3 +-- arch/riscv/include/asm/pgtable.h | 2 -- arch/s390/include/asm/pgtable.h | 10 ---------- arch/sh/include/asm/pgtable_32.h | 8 -------- arch/sparc/include/asm/pgtable_32.h | 15 +++++---------- arch/sparc/include/asm/pgtable_64.h | 1 - arch/um/include/asm/pgtable-2level.h | 1 - arch/um/include/asm/pgtable-4level.h | 9 --------- arch/um/include/asm/pgtable.h | 18 ++++++++---------- arch/x86/include/asm/pgtable.h | 19 +++---------------- arch/xtensa/include/asm/pgtable.h | 6 ------ include/linux/mm.h | 22 ++++++++++++++++++++++ mm/memory.c | 8 +++++--- mm/userfaultfd.c | 2 +- 29 files changed, 45 insertions(+), 154 deletions(-) -- 2.47.2