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=-2.5 required=3.0 tests=MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT 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 3BA62C43382 for ; Wed, 26 Sep 2018 06:12:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6AFD2089D for ; Wed, 26 Sep 2018 06:12:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6AFD2089D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbeIZMYG (ORCPT ); Wed, 26 Sep 2018 08:24:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:55904 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726370AbeIZMYF (ORCPT ); Wed, 26 Sep 2018 08:24:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0F4F1B0F7; Wed, 26 Sep 2018 06:12:48 +0000 (UTC) Date: Wed, 26 Sep 2018 08:12:47 +0200 From: Michal Hocko To: David Rientjes Cc: Andrew Morton , Vlastimil Babka , Alexey Dobriyan , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: Re: [patch v3] mm, thp: always specify disabled vmas as nh in smaps Message-ID: <20180926061247.GB18685@dhcp22.suse.cz> References: <20180924195603.GJ18685@dhcp22.suse.cz> <20180924200258.GK18685@dhcp22.suse.cz> <0aa3eb55-82c0-eba3-b12c-2ba22e052a8e@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 25-09-18 14:50:52, David Rientjes wrote: [...] Let's put my general disagreement with the approach asside for a while. If this is really the best way forward the is the implementation really correct? > + /* > + * 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; > + } Do we want to report all vmas nh? Shouldn't we limit that to THP-able mappings? It seems quite strange that an application started without PR_SET_THP_DISABLE wouldn't report nh for most mappings while it would otherwise. Also when can we have vma->vm_mm == NULL? > + > 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, ' '); -- Michal Hocko SUSE Labs