From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 18CA4C4338F for ; Wed, 4 Aug 2021 14:08:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A769860E52 for ; Wed, 4 Aug 2021 14:08:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A769860E52 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3C8A26B0072; Wed, 4 Aug 2021 10:08:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3516E6B0073; Wed, 4 Aug 2021 10:08:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2668D0001; Wed, 4 Aug 2021 10:08:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 059256B0072 for ; Wed, 4 Aug 2021 10:08:03 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B4229248A5 for ; Wed, 4 Aug 2021 14:08:02 +0000 (UTC) X-FDA: 78437577204.10.C7FFCF6 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by imf10.hostedemail.com (Postfix) with ESMTP id 5581760107E7 for ; Wed, 4 Aug 2021 14:08:02 +0000 (UTC) Received: by mail-lj1-f172.google.com with SMTP id o10so2781582ljp.0 for ; Wed, 04 Aug 2021 07:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=K/1hIIUEbQdHadT/oKJrFQyOilzrUMQ7JriDO/PKmP8=; b=CaIy+F5QRGQNevDHXpZTxRH9bA5lR5VAY+6czcBCluc2KlshpMtIkz6lJO5mTRFBnp CDutMw01CD2gBZJVoGw5xFXSP+SIgZ0OE74wyP1Bqja2c5LX+ln6tCnOU+MMAUgBKZ7q QMxwyN0CvQwPLgGpmNruGFTz77WxXHSfdFzCL9vxOivXEZASS+B74Wrq8/7pkx6hzB1x Y13UHB3EssNVwX8LfkUhrivXHqtnvGWf/FRKLDCMDKjQbJOnSM4EsXnfNOXRDtOcPTVy gYXducqSiF8TDOpa8S7Q/rvzdvyay09xA1jdaWHZ3ao+zop8j8e4ADNtyLF5jAeLvBzR +wfQ== 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:references :mime-version:content-disposition:in-reply-to; bh=K/1hIIUEbQdHadT/oKJrFQyOilzrUMQ7JriDO/PKmP8=; b=aXvMqZWzAdZuhLW/V26as0XbcALYIgkS9E+vxN1odJTw+TV5h2nPgs25VNX1VZ2WCk /TVxG7as2mWFWeANQB7d10XOe7eBmYmIPe8j5MxS+J6w6ctkAPFzP1IPq0mMJRfoyhoP IAYhJSDpnKZZKB3F9gZaKX8nF+Gih8JVPKcN5YntX3VDcBCzg02kGVgxkX7Qhi3KW/gw 3XLVMb/SMCgkvlKP9DyZE7QrPAe6JVJjkqYW+EOxAh+H6dtO+eJu9Fsmo8IgtaomAXkQ lmS+UzIjU/Rq+x1cmbuEWSqzUC/9/iyfn+PlI6PIA37vsPkPW1CHXgLkEnEIdFnIFSda GLCw== X-Gm-Message-State: AOAM532c2xWiXU+qzHmmYLUeR6nMQwZI25K3Tjl6a73sByzBMYrrS1Ko DGilnXpCVn5LdkGYpcKRovFoBQ== X-Google-Smtp-Source: ABdhPJxnNNRjudOBH+EC3ggdRmxYH3p0MEAw3+OrnckCUVM8V25244yYm95tjjoSqYZ64sniZmicUw== X-Received: by 2002:a2e:9241:: with SMTP id v1mr17640443ljg.48.1628086080453; Wed, 04 Aug 2021 07:08:00 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id r8sm168037ljn.52.2021.08.04.07.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 07:07:59 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 15382102BC1; Wed, 4 Aug 2021 17:08:05 +0300 (+03) Date: Wed, 4 Aug 2021 17:08:05 +0300 From: "Kirill A. Shutemov" To: Hugh Dickins Cc: Andrew Morton , 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: Re: [PATCH 08/16] huge tmpfs: fcntl(fd, F_HUGEPAGE) and fcntl(fd, F_NOHUGEPAGE) Message-ID: <20210804140805.vpuerwaiqtcvc5or@box.shutemov.name> References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> <1c32c75b-095-22f0-aee3-30a44d4a4744@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1c32c75b-095-22f0-aee3-30a44d4a4744@google.com> Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=CaIy+F5Q; spf=none (imf10.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.208.172) smtp.mailfrom=kirill@shutemov.name; dmarc=none X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5581760107E7 X-Stat-Signature: zin3wn9khk3mtkb897bfj5y7ng5y5sgp X-HE-Tag: 1628086082-547669 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: On Fri, Jul 30, 2021 at 12:48:33AM -0700, Hugh Dickins wrote: > Add support for fcntl(fd, F_HUGEPAGE) and fcntl(fd, F_NOHUGEPAGE), to > select hugeness per file: useful to override the default hugeness of the > shmem mount, when occasionally needing to store a hugepage file in a > smallpage mount or vice versa. Hm. But why is the new MFD_* needed if the fcntl() can do the same. > These fcntls just specify whether or not to try for huge pages when > allocating to the object later: F_HUGEPAGE does not touch small pages > already allocated (though khugepaged may do so when the file is mapped > afterwards), F_NOHUGEPAGE does not split huge pages already allocated. > > Why fcntl? Because it's already in use (for sealing) on memfds; and I'm > anxious to keep this simple, just applying it to whole files: fallocate, > madvise and posix_fadvise each involve a range, which would need a new > kind of tree attached to the inode for proper support. Most of fadvise() operations ignore the range. I like fadvise() because it's less prescriptive: kernel is free to ignore it. -- Kirill A. Shutemov