From patchwork Mon Dec 19 16:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13076861 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B71FFC4167B for ; Mon, 19 Dec 2022 16:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232245AbiLSQbz (ORCPT ); Mon, 19 Dec 2022 11:31:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbiLSQbu (ORCPT ); Mon, 19 Dec 2022 11:31:50 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA26212A84 for ; Mon, 19 Dec 2022 08:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671467453; 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=QBdeoAN+MduRpz5Invgp6CatIcsWWzCUyVqTEr/eOQo=; b=YAEJSudwfiO60L84qq9jLCrMtoIfFMMPUh2xJImrEj45ZUZLsQ2IrLQ9FXva0CI96x4mz6 eSSkOv9Zpcz5FHLRqJLh99mrQ9NN2cziXqRu3R5jzCmRsxG+gMyAGC5twgPrcNUNMkbKRN I91I7ourvxhGL4aEi6+xBVbKJ1lIHew= 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-605-oH3lA0ujOL-DL8Cnt7igAQ-1; Mon, 19 Dec 2022 11:30:19 -0500 X-MC-Unique: oH3lA0ujOL-DL8Cnt7igAQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA7CE858F0E; Mon, 19 Dec 2022 16:30:18 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.39.194.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 951E040C945A; Mon, 19 Dec 2022 16:30:14 +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 , Linus Torvalds , Andrew Morton , Arnd Bergmann , Greg Kroah-Hartman , Nicolas Pitre , Jens Axboe , Pavel Begunkov Subject: [PATCH mm-stable RFC 0/2] mm/nommu: don't use VM_MAYSHARE for MAP_PRIVATE mappings Date: Mon, 19 Dec 2022 17:30:11 +0100 Message-Id: <20221219163013.259423-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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: Linus Torvalds Cc: Andrew Morton Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Jens Axboe Cc: Pavel Begunkov David Hildenbrand (2): 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/char/mem.c | 2 +- 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 +++++++++++++++++++++++++------------------ 8 files changed, 62 insertions(+), 32 deletions(-)