Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp351126imm; Tue, 25 Sep 2018 23:13:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV63/RBqUw9+ycbDO6oZuIxT9SP3M60Bq1NiT8EoC7NZDNxU57z+cU4dsTbqdwI9f5kfQOUOd X-Received: by 2002:a63:c608:: with SMTP id w8-v6mr4201061pgg.16.1537942388690; Tue, 25 Sep 2018 23:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537942388; cv=none; d=google.com; s=arc-20160816; b=lqvC3e1Dd8tcTVtTA2aSoSkZvGyTjUSd6NJgDAOlhM4XPYrpWTpuFuoKAKrLhCEprf XKjmg9BdZntVxpGThj8GK6jFP4tp/NskAlJigPd2VhU48w7uF+OfZbRIB038rBkt/Oxi /1GmzU7WGfLOqnPqV9ExQZMjvFGIcmHu3KCi2HEF76APIdK8A22tpFWQ789lNkrWpzCz YBazEUr+lUGGkb4Wn3xajqbXj4vxjGrJXr1iw9+PNuHGuI5LSXiJKBBH3sG97o5/+4fl OH3HyuIbWtcW94sfXHJTRXcEAQU3+ATHksShbwOIjJ/YE6NUCPw4e9OQGINwlW5TW8l1 cuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=H/QbuI/r6ITjr0uZLK03+lqptsYnThO1MNp6p+JPJ0E=; b=WtRAKG3aEyycMc98Rq9rDCQN1XDN0sOBXgJEKM0W2xbY6Ie/0DzqHB7XuzXQc+aYPQ 0kdOHlTw+PW+sweTGpAAgCykvSaLKbnbq2h5aqNm2j6tBFEnTVBzQ/L/aIKZQ69mSjRR dOrxAt4+uWe9frCTHJ5NQ+Q/+I4edPzrKG96YW6CG9Oe1FWctiKQQBpQctxtki1e7LtS 2CCT4twWTjLORtBfbYUhBGz6ZK2vRthVdGqmG3CRhSQxtTYtJUJytL6D3qfAwW+ZS8dy +OyLbTQmCjQgufalPzYz1Jkt8ZwprKo3+D2efgNYkgjYcu8zWlqG8F/UJ0UWaswFr3r6 uR7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j62-v6si4281527pfb.348.2018.09.25.23.12.53; Tue, 25 Sep 2018 23:13:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726765AbeIZMYF (ORCPT + 99 others); Wed, 26 Sep 2018 08:24:05 -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