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: 13076855 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 17808C4332F for ; Mon, 19 Dec 2022 16:30:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 915578E0002; Mon, 19 Dec 2022 11:30:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C5918E0001; Mon, 19 Dec 2022 11:30:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78D458E0002; Mon, 19 Dec 2022 11:30:26 -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 68E298E0001 for ; Mon, 19 Dec 2022 11:30:26 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2F3291C5D5F for ; Mon, 19 Dec 2022 16:30:26 +0000 (UTC) X-FDA: 80259593652.15.25F02E9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 86A1680006 for ; Mon, 19 Dec 2022 16:30:23 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ccG3eaxY; spf=pass (imf30.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=1671467423; a=rsa-sha256; cv=none; b=Z94bCE6LEIPkvqFavcoG9E4Zhhz9gNWjRzeNmQwr1VsArpJQHucGX2E/4ceMQcwAFS8xW6 51A3Q6PW6NxpA686EL42SWvmgyW/vhGuANDC/giYgyed5Hq7UnhAV7xRDtmh7dzjI3tpf2 aHwo3kAKVq6MRg3ifQlqR4vEd//4u6E= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ccG3eaxY; spf=pass (imf30.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=1671467423; 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=QBdeoAN+MduRpz5Invgp6CatIcsWWzCUyVqTEr/eOQo=; b=sn0zsWuyTo6UNaVAkmVKDaZfiMTKhPEZrVdb3KepkPqKnjQqXxN3+WqPiDaPc7bXAE4UZE ltKQksAv40x36qTPaNKfQJ3j5WY0fMiLZEQMYtdxGTwpvZrPR+xgOLdeULX4dH8dEkphaY h1wHJcSbmBfJOLAtVsf5kM4eBCwCaQY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671467422; 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=ccG3eaxYQKO+nGqTpK9UuvbWmcfhRCOh0NXVuzkovT6SUFezwKd8cblNRe46cLa5Pxt1oD 78G9dzdwcrSvTzJGqtoGGZusDFr+J4iOysdQjL4hbDfFaUVa0FYarFK3PIXHscaivW36/Z 4HNIREnyL4p+wDgo1ktnSixRZAsWsfY= 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 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 86A1680006 X-Stat-Signature: wa1yf8z1xsddcxeqhwr4fctcxtbccumo X-HE-Tag: 1671467423-168317 X-HE-Meta: U2FsdGVkX1/oiP0YsR5ZXmH+ON2xLC/54p69AxFREL9pW/Cg4kZkt+9vm5F9ZxViUAHfE/Bo7oF5bcf2lt3IeojlDfOOIKFpWethsambwolcxXZ5QgJeIacRmPJpB0h5xm2elNBhtwYNfD6LuLRx6eKAS5fVW8dY3u3HpbF5dez2d3SeOWCttpcs84ewgTqE4xugWx5VhZLiCcfh8l7sGkSvHyx0b/t+dMk4UpvTjUGyGvXfeo/1l+bQgG+Tn7pT2JASVn6d5yMw76UYQpYZpo+aRj+5vwo9dEZo3sRVmbta0VD9Ev3nUqPGl5vD3SVX/GIu5QT76AeGIX5x37vzWiE+8G2AtJYxr+rJljUJ5mghpbR5et36KBmNsX5X9LpbUzQ9PJrN/99K3oneSTwrHMRgXWWcdghkLNAg7kjmmo8Ce7iChYjzegIN6WO3rz8fbPJ+4xFu7a7jS2LMmkvtMNKo57alCYDowA1UzHkWPXX89tqL1byu88wTrcW5A0FSwPLpw4/IuT/zKVPUMsa2dLe0e0mVmEX1xCnRNAezAyVVjiUBNsvnFKrMTk+UPlfi0r9bCRryOfU9d40flp9QDWxP5vDFHUBROQ/qItlnki5KP5QFs8005lKQz7gwzO5V2r6uEpD0tbyhJiGaHwdZp1jkN4b2tSQ2WBhGTgfvOZBfqbLm60B08GcZiBRhEmuKCjvyCzWfbHUn49t+0h3dXTQgeNkVFhy6M1NZtg6+jELRmivslI8R6wPSp+qFl9sEnbHlgKxC/CrSy0V1NcxWUGLrei/JcQxo66wT/NY8hNazBoeYDIPZO96wc4DcPmHaXRD8kvedCkApN7S1bvtfZGFVjXZ2Se0lgrGla3YTQm/JjKBKONOu9CZKg4KOr4TJbjC5m22y77BBXwWabCE4llNZ+uKNy2ueozLmnRbwE4qD8ublJYnxhgt8Rk4CEDam43mOYLiUSdvvOnJEKpP bPJZzKPE L8wkTENIddvR8iYV6kxPlaHw2RQzgc6A9F/BBaF4CIyHX1qgOTh4SeuTLKL+GRPeWgBqs 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: 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(-)