From: Song Liu <songliubraving@fb.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Linux-MM <linux-mm@kvack.org>,
Matthew Wilcox <matthew.wilcox@oracle.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Kernel Team <Kernel-team@fb.com>,
William Kucharski <william.kucharski@oracle.com>,
"Chad Mynhier" <chad.mynhier@oracle.com>,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH v2 3/3] mm,thp: add read-only THP support for (non-shmem) FS
Date: Fri, 21 Jun 2019 13:08:39 +0000
Message-ID: <B83B2259-7CF5-411E-BC4C-7112657FC48E@fb.com> (raw)
In-Reply-To: <20190621125810.llsqslfo52nfh5g7@box>
Hi Kirill,
> On Jun 21, 2019, at 5:58 AM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> On Fri, Jun 14, 2019 at 11:22:04AM -0700, Song Liu wrote:
>> This patch is (hopefully) the first step to enable THP for non-shmem
>> filesystems.
>>
>> This patch enables an application to put part of its text sections to THP
>> via madvise, for example:
>>
>> madvise((void *)0x600000, 0x200000, MADV_HUGEPAGE);
>>
>> We tried to reuse the logic for THP on tmpfs. The following functions are
>> renamed to reflect the new functionality:
>>
>> collapse_shmem() => collapse_file()
>> khugepaged_scan_shmem() => khugepaged_scan_file()
>>
>> Currently, write is not supported for non-shmem THP. This is enforced by
>> taking negative i_writecount. Therefore, if file has THP pages in the
>> page cache, open() to write will fail. To update/modify the file, the
>> user need to remove it first.
>>
>> An EXPERIMENTAL config, READ_ONLY_THP_FOR_FS, is added to gate this
>> feature.
>
> Please document explicitly that the feature opens local DoS attack: any
> user with read access to file can block write to the file by using
> MADV_HUGEPAGE for a range of the file.
>
> As is it only has to be used with trusted userspace.
>
> We also might want to have mount option in addition to Kconfig option to
> enable the feature on per-mount basis.
This behavior has been removed from v3 to v5.
Thanks,
Song
next prev parent reply index
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 18:22 [PATCH v2 0/3] Enable THP for text section of non-shmem files Song Liu
2019-06-14 18:22 ` [PATCH v2 1/3] mm: check compound_head(page)->mapping in filemap_fault() Song Liu
2019-06-17 14:59 ` Rik van Riel
2019-06-14 18:22 ` [PATCH v2 2/3] mm,thp: stats for file backed THP Song Liu
2019-06-17 15:00 ` Rik van Riel
2019-06-21 12:50 ` Kirill A. Shutemov
2019-06-21 14:09 ` Song Liu
2019-06-14 18:22 ` [PATCH v2 3/3] mm,thp: add read-only THP support for (non-shmem) FS Song Liu
2019-06-17 15:42 ` Rik van Riel
2019-06-21 12:58 ` Kirill A. Shutemov
2019-06-21 13:08 ` Song Liu [this message]
2019-06-21 13:11 ` Kirill A. Shutemov
2019-06-18 21:12 ` [PATCH v2 0/3] Enable THP for text section of non-shmem files Andrew Morton
2019-06-18 21:48 ` Song Liu
2019-06-20 1:13 ` Andrew Morton
2019-06-20 2:04 ` Song Liu
2019-06-19 6:26 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B83B2259-7CF5-411E-BC4C-7112657FC48E@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=chad.mynhier@oracle.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-mm@kvack.org \
--cc=matthew.wilcox@oracle.com \
--cc=mike.kravetz@oracle.com \
--cc=william.kucharski@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Linux-mm Archive on lore.kernel.org
Archives are clonable:
git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
linux-mm@kvack.org
public-inbox-index linux-mm
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kvack.linux-mm
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git