Message ID | 20221224081203.3193960-2-zokeefe@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 6C3FAC4332F for <linux-mm@archiver.kernel.org>; Sat, 24 Dec 2022 08:12:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A0F72900004; Sat, 24 Dec 2022 03:12:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9983294000A; Sat, 24 Dec 2022 03:12:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86047900006; Sat, 24 Dec 2022 03:12:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 79ECB900004 for <linux-mm@kvack.org>; Sat, 24 Dec 2022 03:12:21 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4D70BC0691 for <linux-mm@kvack.org>; Sat, 24 Dec 2022 08:12:21 +0000 (UTC) X-FDA: 80276482482.27.A6EDC9B Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf19.hostedemail.com (Postfix) with ESMTP id B7A2D1A0005 for <linux-mm@kvack.org>; Sat, 24 Dec 2022 08:12:19 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=IQNrJhCR; spf=pass (imf19.hostedemail.com: domain of 3YrSmYwcKCIkC1xrrsrt11tyr.p1zyv07A-zzx8npx.14t@flex--zokeefe.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3YrSmYwcKCIkC1xrrsrt11tyr.p1zyv07A-zzx8npx.14t@flex--zokeefe.bounces.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=1671869539; 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:in-reply-to:references:references:dkim-signature; bh=ItQBUrV0EvZiYOjtPn9RtcHJwdM5uCOC63vNEO/Cgn4=; b=Edv0MGTxm6BGH7Y782wij5RARDSeLpudycqM5DQmoIeMwXcVHwSvqe0IUND6tndOYeJc0m YafhI+y3qV+4Kj94P781H/zylx0OaG6d2J24qySheMmU4br/uBCiQQwrf32RfMygFpVm1m Imp6Ak7PVeYc1kk+xxJNNAygkokO4tw= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=IQNrJhCR; spf=pass (imf19.hostedemail.com: domain of 3YrSmYwcKCIkC1xrrsrt11tyr.p1zyv07A-zzx8npx.14t@flex--zokeefe.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3YrSmYwcKCIkC1xrrsrt11tyr.p1zyv07A-zzx8npx.14t@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671869539; a=rsa-sha256; cv=none; b=Ao25tfH9PDIWhMETq2sLCRGcB2X4sScwDO2eMhcI4HHdQsgMVhEnoMwDqR6q9j1ai0Jm36 URuFz9OxdbKK0lagGM4DOnUTiAm0w5h/cU6M20fplqazJkdFtcVe6qLqdgApsXEF1p6fPj 0QXkVXSVDXPSr6sThogpnQ+CF96lLp8= Received: by mail-pf1-f202.google.com with SMTP id cp23-20020a056a00349700b005775c52dbceso3604327pfb.21 for <linux-mm@kvack.org>; Sat, 24 Dec 2022 00:12:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ItQBUrV0EvZiYOjtPn9RtcHJwdM5uCOC63vNEO/Cgn4=; b=IQNrJhCRWbch37b0zxiQ63klwB/GGCz0T3Ti+BnTbJFnWDAuKxZuxygKiPLeM+O0AR w/T2lFf+mrPfJE/QEm2dA04gLVnrUB0sjvh4mOGQ0L26Qki+z+qwi+gk41DAtyORCPyd xTjFieSO7GBH4ut5SB0J3jEXfQ7FMh3pxSwPoz/OHCGFw8TSmZKZxwP/JCiLOnektegW Vmxhwp1NU8QaK6s+ZiVaZ0vSUG4se+Ch/6vOTg54/jZg8pz+Dwnszf0rzMCW3udUjA4S 5zQdWNFo64+OlvLPScP5CEMif/f89OuQZi8ioPTgb23fkNwP4zciNWW7SJXWpZ/mQDF8 0MUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ItQBUrV0EvZiYOjtPn9RtcHJwdM5uCOC63vNEO/Cgn4=; b=x0VuWjVrIVE3qzYFxfwq35rETIjdURmQlAVAcHp59qEbjrlq/k8RhtUZYc1G6jpjF0 im/olcYYGuMvagfT2Gd0HnCd7/eC4HPYmEajD4mZVjaDGBVNDizldM/IsY5UpNzBiVJN JYJiglLssAEcBmhDmKizCa63/L4e+nZdRYZfXDngOCDk25H927eU+jtn0e6zHt39ZQHR JfsrF31Ed1/UE4Xfv6cKi1wF9VVeMxpkzi5lUapylVo71s/j3XMCSmcBfBm8MEVilESt FJQ/y5ENOb3oX5TfjNCaq3Jh98lPgKdmgbgZeQnYxhGRDLOs46ltEi7rVWXRaBfOMfgN ED0A== X-Gm-Message-State: AFqh2kpyP/IPZGzj5hWFUIg0xM2HPXy6PsyD3SYpvoYDnRC3Wd1ucj4d +yZHCINW95HoMvZW3NcCclUT7gQG8yfKo59jiqdWMPZZ7In6JMM/zfaTPJHN6JRfoGKgVp4lHta aaifk0vakTpJ0/RnRVb3tkbDiFVMyibKCeZldL61T/IOVcFG+rKsLUcTJ9Ck= X-Google-Smtp-Source: AMrXdXsO97Tf6V+s4D4bpX/S6mjRj56+jxyaaHemqoaz8G5Nwc8Bqz8Sa7QxAErbsdzR57ehavEIxWJ9q3OD X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:902:c10a:b0:189:cf7a:b564 with SMTP id 10-20020a170902c10a00b00189cf7ab564mr893175pli.8.1671869538392; Sat, 24 Dec 2022 00:12:18 -0800 (PST) Date: Sat, 24 Dec 2022 00:12:03 -0800 In-Reply-To: <20221224081203.3193960-1-zokeefe@google.com> Mime-Version: 1.0 References: <20221224081203.3193960-1-zokeefe@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221224081203.3193960-2-zokeefe@google.com> Subject: [PATCH v2 2/2] mm/shmem: restore SHMEM_HUGE_DENY precedence over MADV_COLLAPSE From: "Zach O'Keefe" <zokeefe@google.com> To: linux-mm@kvack.org Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>, Hugh Dickins <hughd@google.com>, Yang Shi <shy828301@gmail.com>, "Zach O'Keefe" <zokeefe@google.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B7A2D1A0005 X-Stat-Signature: quk9r9ssfb43tr9obydhuqeho3adri3s X-Rspam-User: X-HE-Tag: 1671869539-315411 X-HE-Meta: U2FsdGVkX19f4D8cQorEjo9kjesD/hzjw/aBgzKFaJecz08Jb9JFTczOLThncdmoz7E3vIyhisvobx6sDZZYaoSRteNbUUySRZ7stNu6+cFDDQJjM7uzvVXzg8/hapXkRSZjnkLPqtdwP3fNWdKciESRNwehOpFDMBd5+89D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CwlbFfMKuLntvOsu2ARO7LDwNrssnIzHWGmE9NyX209xLatyWikT3zyjCVyWSZre2uAKu/+tP9H1IFDl9MBqMMlZW+fPwhqAwAYh8wqP1pfwiiqsurFycDCyby6bmFW5rebqg7fvm2SE70Mors6XqLMWp4Cad6bYo2QYnigv 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: <linux-mm.kvack.org> |
Series |
[v2,1/2] mm/MADV_COLLAPSE: don't expand collapse when vm_end is past requested end
|
expand
|
diff --git a/mm/shmem.c b/mm/shmem.c index c301487be5fb..0005ab2c29af 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -478,12 +478,10 @@ bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode, if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) || test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags))) return false; - if (shmem_huge_force) - return true; - if (shmem_huge == SHMEM_HUGE_FORCE) - return true; if (shmem_huge == SHMEM_HUGE_DENY) return false; + if (shmem_huge_force || shmem_huge == SHMEM_HUGE_FORCE) + return true; switch (SHMEM_SB(inode->i_sb)->huge) { case SHMEM_HUGE_ALWAYS:
SHMEM_HUGE_DENY is for emergency use by the admin, to disable allocation of shmem huge pages if, for example, a dangerous bug is found in their usage: see "deny" in Documentation/mm/transhuge.rst. An app using madvise(,,MADV_COLLAPSE) should not be allowed to override it: restore its precedence over shmem_huge_force. Restore SHMEM_HUGE_DENY precedence over MADV_COLLAPSE. Fixes: 7c6c6cc4d3a2 ("mm/shmem: add flag to enforce shmem THP in hugepage_vma_check()") Suggested-by: Hugh Dickins <hughd@google.com> Signed-off-by: Zach O'Keefe <zokeefe@google.com> Cc: Yang Shi <shy828301@gmail.com> --- v1->v2: Update changelog, and add note explaining rationale for backporting (Andrew Morton). Request to backport this to 6.1.X stable. We'd like SHMEM_HUGE_DENY to take precedence over MADV_COLLAPSE. If we make this change later, it will be a userspace API change. As such, 6.1 cannot be allowed to continue as-is, and we should fix up the code there. --- mm/shmem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)