From patchwork Fri Jul 30 07:22:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12410557 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49BC8C4320E for ; Fri, 30 Jul 2021 07:22:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B2E166101C for ; Fri, 30 Jul 2021 07:22:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B2E166101C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0BF4A6B0036; Fri, 30 Jul 2021 03:22:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06EE06B005D; Fri, 30 Jul 2021 03:22:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA0168D0001; Fri, 30 Jul 2021 03:22:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id CE9186B0036 for ; Fri, 30 Jul 2021 03:22:57 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 899F526DD2 for ; Fri, 30 Jul 2021 07:22:57 +0000 (UTC) X-FDA: 78418412394.15.5F389A5 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by imf01.hostedemail.com (Postfix) with ESMTP id 48E765030178 for ; Fri, 30 Jul 2021 07:22:57 +0000 (UTC) Received: by mail-qk1-f169.google.com with SMTP id c9so8521874qkc.13 for ; Fri, 30 Jul 2021 00:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version; bh=W19ulHdbRii8uGULgM4xCYIrYZn/kkVxbVYhZIEWkWk=; b=IWpcSmeCeF6GGdHsOxfv5cO5VtTb2UpZlZv2kMHjrK1vD6llmIA49c41Kip/TzTPQC 8pyBPuaKLUt3CjflHMs0OcSM+lv74B8UjBe+RIJUDmnzvVHB/Bbg4VUAjDXfXjK+BcTp MmJPREd21f/WQPa3PW2F8+95/NsMu7LXr6OSruWBxnRNlia9jC4qRKe3RsVg1R5wuih3 94Y2iPdQjcGv3Xae+Nov4IWLssQ3IhpyOAHDgRmhqziDfcNMB3WJ1I7WzK5+NhU6zq/F 4BrZa229o2W9RrXccNVRCyv1J+u+UhtBoHYbQWfKC0saEpi1N9y2FUBDFT2sA+xQVltK DKug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version; bh=W19ulHdbRii8uGULgM4xCYIrYZn/kkVxbVYhZIEWkWk=; b=DacyHlajSIbiZK2rwu6tDB4MtCHjElmQ4YMhssgCDL9/ZTPQ3sfS7vSmojIW0Kh1pz 1uGJOw03Gqh4BbalRj/herefBbYACx64TVlTMwUNB7eX+qw2x6RqyJswDtiiGadg7lOl In+BhhlAfpYHjkWRu2Qu4zXkOBSbHph6jYeDLUsdGQM+Vea8jhUcDItQBO1cLyrMu0o7 XeZir3bnuLxKv1GaOViw3W2aajh8V6EqK5+uWa3CBZRkcfYd1kgCW25zu1qEfvGRpxMQ 7LWQIrfi70VmO4HpZ6FhXXma/P7epfPalstVuEAORFhpP9ltp/ko5j4LTATYdmRZObHL eJrA== X-Gm-Message-State: AOAM531tr2oGZ1aV5ziOgWQG1HY4reej2sD4iVTbvXGobxhaO8PcR+Zq tkj3uCXb9hVU4hVvfM/U8RppOA== X-Google-Smtp-Source: ABdhPJykA6Jb3yBOp5zc/TcieykN44zj2IVlu/Hldx8zKyLBorE+22RYQHjNgr4D6QAgGwOovh/0Sw== X-Received: by 2002:a05:620a:1227:: with SMTP id v7mr998851qkj.3.1627629776350; Fri, 30 Jul 2021 00:22:56 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id b204sm490194qkg.76.2021.07.30.00.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 00:22:55 -0700 (PDT) Date: Fri, 30 Jul 2021 00:22:41 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Andrew Morton cc: Hugh Dickins , Shakeel Butt , "Kirill A. Shutemov" , Yang Shi , Miaohe Lin , Mike Kravetz , Michal Hocko , Rik van Riel , Christoph Hellwig , Matthew Wilcox , "Eric W. Biederman" , Alexey Gladkov , Chris Wilson , Matthew Auld , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 00/16] tmpfs: HUGEPAGE and MEM_LOCK fcntls and memfds Message-ID: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 48E765030178 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=IWpcSmeC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of hughd@google.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=hughd@google.com X-Stat-Signature: 4oj44baydf3zr1zrqc6jm7ha9wtqsbbf X-HE-Tag: 1627629777-402412 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: A series of HUGEPAGE and MEM_LOCK tmpfs fcntls and memfd_create flags, after fixes (not essential for stable) and cleanups in related areas. Against 5.14-rc3: currently no conflict with linux-next or mmotm. 01/16 huge tmpfs: fix fallocate(vanilla) advance over huge pages 02/16 huge tmpfs: fix split_huge_page() after FALLOC_FL_KEEP_SIZE 03/16 huge tmpfs: remove shrinklist addition from shmem_setattr() 04/16 huge tmpfs: revert shmem's use of transhuge_vma_enabled() 05/16 huge tmpfs: move shmem_huge_enabled() upwards 06/16 huge tmpfs: shmem_is_huge(vma, inode, index) 07/16 memfd: memfd_create(name, MFD_HUGEPAGE) for shmem huge pages 08/16 huge tmpfs: fcntl(fd, F_HUGEPAGE) and fcntl(fd, F_NOHUGEPAGE) 09/16 huge tmpfs: decide stat.st_blksize by shmem_is_huge() 10/16 tmpfs: fcntl(fd, F_MEM_LOCK) to memlock a tmpfs file 11/16 tmpfs: fcntl(fd, F_MEM_LOCKED) to test if memlocked 12/16 tmpfs: refuse memlock when fallocated beyond i_size 13/16 mm: bool user_shm_lock(loff_t size, struct ucounts *) 14/16 mm: user_shm_lock(,,getuc) and user_shm_unlock(,,putuc) 15/16 tmpfs: permit changing size of memlocked file 16/16 memfd: memfd_create(name, MFD_MEM_LOCK) for memlocked shmem fs/fcntl.c | 8 fs/hugetlbfs/inode.c | 4 include/linux/mm.h | 4 include/linux/shmem_fs.h | 31 ++- include/uapi/linux/fcntl.h | 17 + include/uapi/linux/memfd.h | 4 ipc/shm.c | 4 mm/huge_memory.c | 6 mm/khugepaged.c | 2 mm/memfd.c | 27 ++ mm/mlock.c | 19 - mm/shmem.c | 397 ++++++++++++++++++++++++++------------- 12 files changed, 370 insertions(+), 153 deletions(-) Hugh