From patchwork Sun Jul 23 20:55:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13323341 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 60561C001DE for ; Sun, 23 Jul 2023 20:55:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B68A56B0071; Sun, 23 Jul 2023 16:55:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B18CC6B0074; Sun, 23 Jul 2023 16:55:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B9416B0075; Sun, 23 Jul 2023 16:55:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 84D9E6B0071 for ; Sun, 23 Jul 2023 16:55:14 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 51E0DB1CDD for ; Sun, 23 Jul 2023 20:55:14 +0000 (UTC) X-FDA: 81044081748.24.33F910D Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf14.hostedemail.com (Postfix) with ESMTP id 8A803100009 for ; Sun, 23 Jul 2023 20:55:11 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=vRkNNrST; spf=pass (imf14.hostedemail.com: domain of hughd@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690145711; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=TY4oWT4BmzbCLpoTbP8uqzxOpbbEPhs/d55O6L9hwVM=; b=V8OT6jQXJpIRcPe5Zwnz6NBxhX3qVt6xoOXBJRqpKG+G058TMpeSvGYRXvtWCRLn7NHHsr E0ZgUeTNKM4XsDSwoFGm8D7CTqiqtE8Imfbx2KIopfTBLgGrMLMyIM2Fnd8MunifXM98lL ZxXkmeulhN5nWH+aHvz2BRe7TlpKP6Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690145711; a=rsa-sha256; cv=none; b=Mxp08bcx89PtEHv0U1tQpw4lzRUiaonQLfR/Tqk7UOcB6aPqH/5HsrrBJ7XSJtNb1Vd9Rq 0iAG/MaHnwgwk3POUrtRzITwthNTE+MzrZYb38B8OmpBLHlEOHZ5MD4tCHx8AlkMxU3vNP hKzpqCI54ZDCClMRifHzwpG2pixX68k= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=vRkNNrST; spf=pass (imf14.hostedemail.com: domain of hughd@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-c4cb4919bb9so4012431276.3 for ; Sun, 23 Jul 2023 13:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690145710; x=1690750510; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=TY4oWT4BmzbCLpoTbP8uqzxOpbbEPhs/d55O6L9hwVM=; b=vRkNNrSTcfhE/l1bOMFJ73ZeZD3Cg0OJYqHLVgN6sa7frN9TEH5M9lx17RdpXOPnDX r2ii4Q5a2GlLxpuaywcH4oi535gMtHBWmcokk4JWEGW4gyNwxepVLK9YKcXHw7/yxUyP qZGsVxrX/ncJTNoIkpijEyzVKP5AhmM5rnE+js8hlhOsUERNX+xXzOKxia0listxcOKe 0CoIxtYa2fio4TzzjiJUr2JxwEXo9Tb2nOuL2FWeboNf3b1OL+TwxUrsw13KVq4x4ERn YDa0aMbL5MeVyBmjTVOhJoYCTet7tzOKKpLGqGv0T861jBvf5JcfqNiQhXjQmgl4s+wL l68w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690145710; x=1690750510; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=TY4oWT4BmzbCLpoTbP8uqzxOpbbEPhs/d55O6L9hwVM=; b=EnTq0QK6N+ufrAEutv+IE7ECtZD2qBDYmHq9gAn+S82naLR+b0MvEYJ6HC5GDUpylc K2NeAZuilLU7WXzORQl2V2DIFkNoxrhTnUchgKm+i3enklGlvpwo+tIrrug2trTdNbae +0H0lHnQ3wCDHMegmFzKlubqaaJ2qgHQIt/nyeEtUYf+O3lVc/d8YYZ5GC4f9NFSpkRd gYmcxWuDFcCq3hEoymWoA2EOmAIce8fS/t3avK1bbwoYl38sgUGADERTRYOi51XZLOKl honCZg5A/6tb6UH9PUIfJXIDaC0N/UcY8MpdMaQaPSPwli55TW2kmKpZDyh+9uHesejw /zBA== X-Gm-Message-State: ABy/qLb0W7IA+PusKlYwYj9V4nrTA3dic/kCTt9pBSvtT8+nKA1y0Tgu zk/gPDxT0vb9Exwzkt/KR1rEVg== X-Google-Smtp-Source: APBJJlHVODtrgl3ATBbSeYuloyXNj+A+wOCcfh07rcSah/7KcVkNUk/mksbD/CHakBHII4RTtjs8eQ== X-Received: by 2002:a25:34d5:0:b0:d10:a134:addd with SMTP id b204-20020a2534d5000000b00d10a134adddmr625722yba.55.1690145710413; Sun, 23 Jul 2023 13:55:10 -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 8-20020a250108000000b00cc567b3a869sm2023917ybb.6.2023.07.23.13.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 13:55:09 -0700 (PDT) Date: Sun, 23 Jul 2023 13:55:00 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Luis Chamberlain , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH mm-hotfixes] tmpfs: fix Documentation of noswap and huge mount options Message-ID: <986cb0bf-9780-354-9bb-4bf57aadbab@google.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8A803100009 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: b5x358if1bqgt5koyaaxpz83jziyxonn X-HE-Tag: 1690145711-962208 X-HE-Meta: U2FsdGVkX19ogCNXebWtvkypMc/nNFrtw2SDwl3p1axYDfR0WKCkOCxh3LQakmgyrzx0iFTnd64Q7mrp0NUR5iKAsNAlo+hs1gAsTTRbg7luNazuxriUCdTVuOJE9/OV4zJcLrLWqrWNHvHAUK4irnv7Y48by10AGJL2X56dejUgD7pju53PbXf5W/wANmnOT4ALaxqHiDTHcMb+tVNIK7FlCbQm0rkj6VTuWVw4Wv+n5Jsi2xu0ckOt2fLIh2Un2JU3gyjQIIFFxKL3/ZNgJlU+Bpm17BznwMF4qJ2tlhD9cBPnjcsKESdFqNr3GOJV8Rp3cZug1wC9cFt4GOkJTJrddm0QkZoTWDfwIV0u08VLa95nK1RY6mXjwvznTJ8unqjWZ3q0RWmxiJq2eAamHrvMBbDHIK95jzR6Xpp8sT9BBGFWUAZOdifXvRsauAIpNlORUM2HC+utgTEb91rH48aJWNqfw3XvlxSVEYbD4PWEZXlYyJILWoTVDmeXtYHTDHKI37shqmBCJcIRdPAk2RvDTIbKyzw0Vyj8BE+pjq1irPpYABVJqkewQsnleZPJ7j5yB08txvCIu6OjL3kheomVlrekByval0fwKoBekng91MO4zMyPShIzbx2kQUqwwFFDIGMhl5eozRropVO6JMPs9JzXfEucWLhAnVguqKLwpQIUCt++RskIYujBr8obiC94Pm6Ase1Xpz4BVI2ypJslvLO16Y0b5GhEEO+apvX9eLbbpICgOzEgvq2r4gfI/22kywRm5SRj0ZSMhvjdgg14Y1My6nqCQtMdrsMNzCK55lWvCtddyO6ikJwN+WMoRNSSm9B0hc5+F7hW96VqBeH/vx61rDWJIChDfUUdNVddtAu/PIw7kQ+t3JsLx80H9iLAfkZHxRvaT6XpHK+jBuMXpO/KAq81/Ibd/ciwCDf9boR0j9T3/oN3Bq1dakZrlVkqB2RbMM8T02BUxuS JPmx5Cmb Lmb0aWupkh/UMkcdI/BgUs53L/6ejicGO5g3waiuDR+67T9QLvWJKqVLfg2knKptDyS+3WkSYaopQ0fo+Bc3HsahAiJQSQP8IhthodzK536oi5PSxsf39Hz+qnqvUqHFgnpZojQlT4L9W0xIukTSxAN15FzHh28MWxu9Dbl5yErJzcycEBcbb89sEaAkRRE7OomP34lDtCjQ5vOycSskESw+woCnAq8fhvvpie3VbRPKghU5g8DRUg7g7ZihJjxSbTfBtPviDtBZ8hexHuPkvJl870SSCImLzHKJ8eE9wwCnBIICvKqRZ+WV0hwQtvS4hrrbWx+toakNx/SEwQyo+7RyeVFiNfovYNCflcZmoGjqtc0z7sqd6f9gNKA1GZaaymaGo 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: The noswap mount option is surely not one of the three options for sizing: move its description down. The huge= mount option does not accept numeric values: those are just in an internal enum. Delete those numbers, and follow the manpage text more closely (but there's not yet any fadvise() or fcntl() which applies here). /sys/kernel/mm/transparent_hugepage/shmem_enabled is hard to describe, and barely relevant to mounting a tmpfs: just refer to transhuge.rst (while still using the words deny and force, to help as informal reminders). Fixes: d0f5a85442d1 ("shmem: update documentation") Fixes: 2c6efe9cf2d7 ("shmem: add support to ignore swap") Signed-off-by: Hugh Dickins Reviewed-by: Luis Chamberlain --- Documentation/filesystems/tmpfs.rst | 45 ++++++++++++----------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst index f18f46be5c0c..28aeaeea47d0 100644 --- a/Documentation/filesystems/tmpfs.rst +++ b/Documentation/filesystems/tmpfs.rst @@ -84,8 +84,6 @@ nr_inodes The maximum number of inodes for this instance. The default is half of the number of your physical RAM pages, or (on a machine with highmem) the number of lowmem RAM pages, whichever is the lower. -noswap Disables swap. Remounts must respect the original settings. - By default swap is enabled. ========= ============================================================ These parameters accept a suffix k, m or g for kilo, mega and giga and @@ -99,36 +97,31 @@ mount with such options, since it allows any user with write access to use up all the memory on the machine; but enhances the scalability of that instance in a system with many CPUs making intensive use of it. +tmpfs blocks may be swapped out, when there is a shortage of memory. +tmpfs has a mount option to disable its use of swap: + +====== =========================================================== +noswap Disables swap. Remounts must respect the original settings. + By default swap is enabled. +====== =========================================================== + tmpfs also supports Transparent Huge Pages which requires a kernel configured with CONFIG_TRANSPARENT_HUGEPAGE and with huge supported for your system (has_transparent_hugepage(), which is architecture specific). The mount options for this are: -====== ============================================================ -huge=0 never: disables huge pages for the mount -huge=1 always: enables huge pages for the mount -huge=2 within_size: only allocate huge pages if the page will be - fully within i_size, also respect fadvise()/madvise() hints. -huge=3 advise: only allocate huge pages if requested with - fadvise()/madvise() -====== ============================================================ +=========== ============================================================== +huge=never Do not allocate huge pages. This is the default. +huge=always Attempt to allocate huge page every time a new page is needed. +huge=within_size Only allocate huge page if it will be fully within i_size. + Also respect madvise(2) hints. +huge=advise Only allocate huge page if requested with madvise(2). +=========== ============================================================== -There is a sysfs file which you can also use to control system wide THP -configuration for all tmpfs mounts, the file is: - -/sys/kernel/mm/transparent_hugepage/shmem_enabled - -This sysfs file is placed on top of THP sysfs directory and so is registered -by THP code. It is however only used to control all tmpfs mounts with one -single knob. Since it controls all tmpfs mounts it should only be used either -for emergency or testing purposes. The values you can set for shmem_enabled are: - -== ============================================================ --1 deny: disables huge on shm_mnt and all mounts, for - emergency use --2 force: enables huge on shm_mnt and all mounts, w/o needing - option, for testing -== ============================================================ +See also Documentation/admin-guide/mm/transhuge.rst, which describes the +sysfs file /sys/kernel/mm/transparent_hugepage/shmem_enabled: which can +be used to deny huge pages on all tmpfs mounts in an emergency, or to +force huge pages on all tmpfs mounts for testing. tmpfs has a mount option to set the NUMA memory allocation policy for all files in that instance (if CONFIG_NUMA is enabled) - which can be