From patchwork Mon Jan 2 16:08:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13086800 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 2D598C3DA7A for ; Mon, 2 Jan 2023 16:09:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 778F58E0002; Mon, 2 Jan 2023 11:09:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 727D08E0001; Mon, 2 Jan 2023 11:09:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 616C58E0002; Mon, 2 Jan 2023 11:09:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 52E238E0001 for ; Mon, 2 Jan 2023 11:09:07 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 25D6712096C for ; Mon, 2 Jan 2023 16:09:07 +0000 (UTC) X-FDA: 80310343134.24.D8571A7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf02.hostedemail.com (Postfix) with ESMTP id AC19C8001F for ; Mon, 2 Jan 2023 16:09:04 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MLDb9UYh; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672675744; 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=QOMPjn0dUYaEDmDsmFebFjuVPC7wNzFHjtW1BGxF+HA=; b=MnKf08X9NE/A6hi7xyCkBqu69qM/SyPzitLXB6VyFKtBIMJwmg6TQroBWTsHmP9wn73vmA aP1Y9atfgU/1/9L0OOVAm+/7poIq0NNjQuJQnsc3VpRn4IS00Unm+vliAKuTrCpof1A6DM tQ37eL71CZh9MJo4cZJDMzL1BUJOBeI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MLDb9UYh; spf=pass (imf02.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672675744; a=rsa-sha256; cv=none; b=fH4O8pPofcT6kZfvNmV/goX/aoN4tMJP2fdysw+8kKXeRb7Sd+b84kaTebeFMoekkgG6UO mzRt20OMLQcw4fWYZALk4vQNTp1Xmof87AE8vceGNgOKuk46RdH4dBpnlMk/3exFie8u4B 3+BAYUL7j5L+gFsxMC7X+0BNZrz1mH4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672675744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QOMPjn0dUYaEDmDsmFebFjuVPC7wNzFHjtW1BGxF+HA=; b=MLDb9UYh3B9YsOCV5Sxht+FKmyeOcv9dqRycd/n1nd7u7KlJ5vOWy20d3uKAv/WIcY7hTq LFTXaYVqan6+o/sSl9D5kpBrCk08SVYAHyKB9xOG4qpnhyVp764ZZJhHvBH0N6a/NKwi8p qcbPUTFGWI2DVWyu2IxvaodZQC+mDdM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-513-HJLq6KMLO_-iX_0gFzvgfQ-1; Mon, 02 Jan 2023 11:09:01 -0500 X-MC-Unique: HJLq6KMLO_-iX_0gFzvgfQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4FD8318A6460; Mon, 2 Jan 2023 16:09:00 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.193.209]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF57C51E5; Mon, 2 Jan 2023 16:08:57 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, David Hildenbrand , Andrew Morton , Arnd Bergmann , Greg Kroah-Hartman , Nicolas Pitre , Jens Axboe , Pavel Begunkov Subject: [PATCH mm-unstable v1 0/3] mm/nommu: don't use VM_MAYSHARE for MAP_PRIVATE mappings Date: Mon, 2 Jan 2023 17:08:53 +0100 Message-Id: <20230102160856.500584-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: AC19C8001F X-Stat-Signature: gasxq75jdjx8jrsh5purzkmeuuy44iih X-Rspam-User: X-HE-Tag: 1672675744-821547 X-HE-Meta: U2FsdGVkX18jn/sAN+GTlxJH4ZED8Ig9pSFFf677PYBRAv2lTh/dpDKHxVjCWyreisrrCjglje0lzM25jW+IbYJmhYvVnNCODrlpYg3DB8ddNEHFVu0qso7d+WQ4kN5NiZaKcjT6BjtIOaWMNh9uAyeC0N9rdnMFuQkZaBk4tKjVPGFUr20jcQgro7fNE/F+eI4iacignHwhx4z4aWlzFUW/2XUctcUC6kQ4JLQIBxijApaMyDeV3iSLQ0Gm3g1cjj5dGUxAVN43y7XoTQ9pDBjytfB13y1KPlSIaKpr70wF3zvvbmwqdtGAb+ofOj09x28F8Q5Na4zIIv2F83her9lV52vkmPQA1FRBBpg74d0RpNCjN4Onhmi1kQ4CLs38wqpqP57pSY+QTGuk+b6QEgXNKDTozR3NgDoNtlv3RaGTfULm0UUz4r4neqDnbgpwwu37LOpw4HSYCVIIq7whoYFU9CufLn/TrL4T0j5EOifCvfSuc3HfcfJNzYRSckioK5GqwRkl9gF0+PkbquoCtgPU5MXjtqtlIDP1NIC/w083cv5/5jYez3fXA75EuXOfD8SraQ/lJfrSJw27Z838CrLQyTFNxT5NxVNmCUXPXjNlNOup1pLL5zzdlX2GN5WZ3DNaMp9VrsR2wDIzRU39VjeOO6Zz7Q3k1GFzT5J3tYlsbn5dTVKnYqZhbiCbEGViJosSIyqWMAV14To69iMCcjH7KS26ufHv7egKzaxeK1exubMLkcpU6qPm9wrJ7p6toushVNT8N9TKp1DWcy5HGTlRL3NGpm4lCpS8qSs/spj4t13MAt17keUnnEDgIFte15DBp1c2jvxeDF8KzNWkVJyMmeXVuH3HirnBuFsgFYhBqXxrTFDaMcwoDnRcD31cj3M2c9+XFceM+blil6I7KJAUTWZyTIYsBaudpc9f8zYFSPohGO9mHaO6gkxpZ+r4Z8KK83oGT0cQ+Sih2od SQ4/OQvn 1wp+i0ct0tgv1wh/ZcNCEJPrJCBEqktFboAT0GPgroFEw04zTMERxlb1HmA== 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: Trying to reduce the confusion around VM_SHARED and VM_MAYSHARE first requires !CONFIG_MMU to stop using VM_MAYSHARE for MAP_PRIVATE mappings. CONFIG_MMU only sets VM_MAYSHARE for MAP_SHARED mappings. This paves the way for further VM_MAYSHARE and VM_SHARED cleanups: for example, renaming VM_MAYSHARED to VM_MAP_SHARED to make it cleaner what is actually means. Let's first get the weird case out of the way and not use VM_MAYSHARE in MAP_PRIVATE mappings, using a new VM_MAYOVERLAY flag instead. I am not a NOMMU expert, but my basic testing with risc64-nommu with buildroot under QEMU revealed no surprises. Cc: Andrew Morton Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Jens Axboe Cc: Pavel Begunkov RFC -> v1: * Rebased, retested * "drivers/misc/open-dice: don't touch VM_MAYSHARE" -> Added; as VM_MAYSHARE semantics are now clearer, it makes sense to include this change in this series. David Hildenbrand (3): mm/nommu: factor out check for NOMMU shared mappings into is_nommu_shared_mapping() mm/nommu: don't use VM_MAYSHARE for MAP_PRIVATE mappings drivers/misc/open-dice: don't touch VM_MAYSHARE drivers/char/mem.c | 2 +- drivers/misc/open-dice.c | 14 ++++----- fs/cramfs/inode.c | 2 +- fs/proc/task_nommu.c | 2 +- fs/ramfs/file-nommu.c | 2 +- fs/romfs/mmap-nommu.c | 2 +- include/linux/mm.h | 20 +++++++++++++ io_uring/io_uring.c | 2 +- mm/nommu.c | 62 +++++++++++++++++++++++----------------- 9 files changed, 68 insertions(+), 40 deletions(-)