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=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 5AF48C433DB for ; Mon, 22 Mar 2021 23:55:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CDF1B619A3 for ; Mon, 22 Mar 2021 23:55:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDF1B619A3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 432966B0078; Mon, 22 Mar 2021 19:55:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BB606B0087; Mon, 22 Mar 2021 19:55:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25B186B00D4; Mon, 22 Mar 2021 19:55:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id 080746B0078 for ; Mon, 22 Mar 2021 19:55:42 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BD4A46D8E for ; Mon, 22 Mar 2021 23:55:41 +0000 (UTC) X-FDA: 77949170082.34.08468C4 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf24.hostedemail.com (Postfix) with ESMTP id 350F1A0000FC for ; Mon, 22 Mar 2021 23:55:40 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C912619A5 for ; Mon, 22 Mar 2021 23:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616457335; bh=VpDFohQxZdeFwzTLulapaQ9fKZPYsThIcB9QTDxJKwU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QjJkDa1ggtnBvgZYRVevMK5DtzMSwdnqcL2IKwZNwVfebXPzXeq9bh5HrmauMIZe8 mcpJ7h1wQ0QtVr1jaT0DnvTITGyr8fywLW3VM8C4i6QW5DhWU0t2SWeCVR0r4gukWU 9/17UjRe8DYBqbSDpZfn4SqYrJoLgOkl04B/FvlY0QiVd6X5tFbgN7L2oD4ARXGiqQ WtgLk2AwqjVl1Ml0zSLMa3uTottJk1yldu7BM2jyTNnG+tibj/vSd53fJHXjvGWp4u 1tLmi3b75wXhCSsF8ttTGxmdaoZEznXWc3HV/ORwpC5KUHm4Qlk762BzsmTW5pl1dY SAoZsLAPI9QwQ== Received: by mail-lj1-f174.google.com with SMTP id z8so23230008ljm.12 for ; Mon, 22 Mar 2021 16:55:35 -0700 (PDT) X-Gm-Message-State: AOAM5337Gz6pXLjBpObQwdMGM3M2XB/KKKqdG35Xzrq+praOV7OFIGkP B6xuOvha8FfSGhHsejUX+cM8xRwuQpsLQAbc2YE= X-Google-Smtp-Source: ABdhPJzeuDx4meNjAF010eIArHffcCcwi/lqemEghn1bNqVX2DsgrA2WhfpeQE44SL87Y1AtRWN2vRbBH+tikm56WU8= X-Received: by 2002:a05:651c:200b:: with SMTP id s11mr1143822ljo.177.1616457333463; Mon, 22 Mar 2021 16:55:33 -0700 (PDT) MIME-Version: 1.0 References: <20210322215823.962758-1-cfijalkovich@google.com> In-Reply-To: <20210322215823.962758-1-cfijalkovich@google.com> From: Song Liu Date: Mon, 22 Mar 2021 16:55:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm, thp: Relax the VM_DENYWRITE constraint on file-backed THPs To: Collin Fijalkovich Cc: Song Liu , surenb@google.com, hridya@google.com, kaleshsingh@google.com, Hugh Dickins , timmurray@google.com, Alexander Viro , Andrew Morton , Linux-Fsdevel , open list , Linux-MM Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: r8jb5u6ix4xpbesj741s3ybni9dfyz9u X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 350F1A0000FC Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616457340-329066 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 Mon, Mar 22, 2021 at 3:00 PM Collin Fijalkovich wrote: > > Transparent huge pages are supported for read-only non-shmem filesystems, > but are only used for vmas with VM_DENYWRITE. This condition ensures that > file THPs are protected from writes while an application is running > (ETXTBSY). Any existing file THPs are then dropped from the page cache > when a file is opened for write in do_dentry_open(). Since sys_mmap > ignores MAP_DENYWRITE, this constrains the use of file THPs to vmas > produced by execve(). > > Systems that make heavy use of shared libraries (e.g. Android) are unable > to apply VM_DENYWRITE through the dynamic linker, preventing them from > benefiting from the resultant reduced contention on the TLB. > > This patch reduces the constraint on file THPs allowing use with any > executable mapping from a file not opened for write (see > inode_is_open_for_write()). It also introduces additional conditions to > ensure that files opened for write will never be backed by file THPs. Thanks for working on this. We could also use this in many data center workloads. Question: when we use this on shared library, the library is still writable. When the shared library is opened for write, these pages will refault in as 4kB pages, right? Thanks, Song