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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham 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 BC959C169C4 for ; Tue, 29 Jan 2019 22:09:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E76B2147A for ; Tue, 29 Jan 2019 22:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbfA2WJk (ORCPT ); Tue, 29 Jan 2019 17:09:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:55168 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbfA2WJj (ORCPT ); Tue, 29 Jan 2019 17:09:39 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 894D83422; Tue, 29 Jan 2019 22:09:38 +0000 (UTC) Date: Tue, 29 Jan 2019 14:09:37 -0800 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, xemul@virtuozzo.com, vbabka@suse.cz, stable@vger.kernel.org, rppt@linux.ibm.com, mhocko@kernel.org, kirill.shutemov@linux.intel.com, gorcunov@gmail.com, avagin@gmail.com, adobriyan@gmail.com, rientjes@google.com Subject: [nacked] mm-thp-always-specify-disabled-vmas-as-nh-in-smaps.patch removed from -mm tree Message-ID: <20190129220937.z-sKp%akpm@linux-foundation.org> User-Agent: s-nail v14.9.6 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: mm, thp: always specify disabled vmas as nh in smaps has been removed from the -mm tree. Its filename was mm-thp-always-specify-disabled-vmas-as-nh-in-smaps.patch This patch was dropped because it was nacked ------------------------------------------------------ From: David Rientjes Subject: mm, thp: always specify disabled vmas as nh in smaps 1860033237d4 ("mm: make PR_SET_THP_DISABLE immediately active") introduced a regression in that userspace cannot always determine the set of vmas where thp is disabled. Userspace relies on the "nh" flag being emitted as part of /proc/pid/smaps to determine if a vma has been disabled from being backed by hugepages. Previous to this commit, prctl(PR_SET_THP_DISABLE, 1) would cause thp to be disabled and emit "nh" as a flag for the corresponding vmas as part of /proc/pid/smaps. After the commit, thp is disabled by means of an mm flag and "nh" is not emitted. This causes smaps parsing libraries to assume a vma is enabled for thp and ends up puzzling the user on why its memory is not backed by thp. This also clears the "hg" flag to make the behavior of MADV_HUGEPAGE and PR_SET_THP_DISABLE definitive. Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1809251449060.96762@chino.kir.corp.google.com Fixes: 1860033237d4 ("mm: make PR_SET_THP_DISABLE immediately active") Signed-off-by: David Rientjes Cc: Michal Hocko Cc: Vlastimil Babka Cc: Alexey Dobriyan Cc: "Kirill A. Shutemov" Cc: Mike Rapoport Cc: Andrei Vagin Cc: Cyrill Gorcunov Cc: Pavel Emelyanov Cc: [4.13+] Signed-off-by: Andrew Morton --- Documentation/filesystems/proc.txt | 7 ++++++- fs/proc/task_mmu.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) --- a/Documentation/filesystems/proc.txt~mm-thp-always-specify-disabled-vmas-as-nh-in-smaps +++ a/Documentation/filesystems/proc.txt @@ -508,9 +508,14 @@ manner. The codes are the following: sd - soft-dirty flag mm - mixed map area hg - huge page advise flag - nh - no-huge page advise flag + nh - no-huge page advise flag [*] mg - mergable advise flag + [*] A process mapping may be advised to not be backed by transparent hugepages + by either madvise(MADV_NOHUGEPAGE) or prctl(PR_SET_THP_DISABLE). See + Documentation/admin-guide/mm/transhuge.rst for system-wide and process + mapping policies. + Note that there is no guarantee that every flag and associated mnemonic will be present in all further kernel releases. Things get changed, the flags may be vanished or the reverse -- new added. Interpretation of their meaning --- a/fs/proc/task_mmu.c~mm-thp-always-specify-disabled-vmas-as-nh-in-smaps +++ a/fs/proc/task_mmu.c @@ -653,13 +653,25 @@ static void show_smap_vma_flags(struct s #endif #endif /* CONFIG_ARCH_HAS_PKEYS */ }; + unsigned long flags = vma->vm_flags; size_t i; + /* + * Disabling thp is possible through both MADV_NOHUGEPAGE and + * PR_SET_THP_DISABLE. Both historically used VM_NOHUGEPAGE. Since + * the introduction of MMF_DISABLE_THP, however, userspace needs the + * ability to detect vmas where thp is not eligible in the same manner. + */ + if (vma->vm_mm && test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)) { + flags &= ~VM_HUGEPAGE; + flags |= VM_NOHUGEPAGE; + } + seq_puts(m, "VmFlags: "); for (i = 0; i < BITS_PER_LONG; i++) { if (!mnemonics[i][0]) continue; - if (vma->vm_flags & (1UL << i)) { + if (flags & (1UL << i)) { seq_putc(m, mnemonics[i][0]); seq_putc(m, mnemonics[i][1]); seq_putc(m, ' '); _ Patches currently in -mm which might be from rientjes@google.com are