Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp402699imm; Wed, 26 Sep 2018 00:17:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV62Gaekui+wJqbuGqzW/UISLpAD1neXY30k9iSQVG1qGahPZFGeFA6FKH3qkpPSqiyl1GS7Z X-Received: by 2002:a17:902:74c7:: with SMTP id f7-v6mr4577761plt.45.1537946273178; Wed, 26 Sep 2018 00:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537946273; cv=none; d=google.com; s=arc-20160816; b=K3od1TSyMFSem3FfqMrXI6LSb27uic5ToP5BpijFp5ogcGlB5kJLuqEtWPFLWLHvKO 9IQNnMtbXxeZWkRszb2pjea6RjDqoBEJWy2Z/lk6n6m8pARhVBbjf6o+A5zeCDR+fBNK olPgaHgwqbtFa5Jt3PTFuWN/VdAXVbihLazZcDu2Rgmm12H/hz1ayLG+Fi8/RVeM7dfE iTgkBRtFGiZG79mrKQ6Q6MPEhldg6wiqKYGNy1qL7AbtGnG2sfSyUknvkKzk6s4owOw6 mxam01KUMt3qV/7guHY2TW5epjElrNU2EUWE8qPoYnbWLL5C6LegidC6DkFzn/0/8qjl Ndyg== 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=uHJfk45vJfLr757RWV3SeXVEpZknB28S2r/01Zbmm6A=; b=SRGG0Mvvb9iEZlBTVzb/UKoCtxtm4YeNWLVVWRbLAzOXedQGtXDJVcdw1nhNFebL9p x7ALFcp+fPaUmrCn22bNOrgz7RLR22AH2oL0Acq5l8+FwuECjRXnK2d/ow+BbcxjQO77 NX6Tg0t7BjNLitUWpANBhWztXLUq/+HcBRugk4QMNeMA5letSDfkUpS7DU+P5PJoT244 5bFwcZAV8Kjn3Jn54AVH7BiWmRmSV7D8kpgqMKiWgGtONwtlSJxfDQmfQFugU9GJ0/op 1XpqTUoEX/uQPHNRZUoO9J5TumDmh8CEFT8P0T2Smy3oYIqXJIoxZxdlTWZBw88RSmML NY7Q== 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 d34-v6si4938704pla.195.2018.09.26.00.17.37; Wed, 26 Sep 2018 00:17:53 -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 S1727372AbeIZN2m (ORCPT + 99 others); Wed, 26 Sep 2018 09:28:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:48354 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727335AbeIZN2m (ORCPT ); Wed, 26 Sep 2018 09:28:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 033FAB019; Wed, 26 Sep 2018 07:17:11 +0000 (UTC) Date: Wed, 26 Sep 2018 09:17:08 +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: <20180926071708.GB6278@dhcp22.suse.cz> References: <20180924195603.GJ18685@dhcp22.suse.cz> <20180924200258.GK18685@dhcp22.suse.cz> <0aa3eb55-82c0-eba3-b12c-2ba22e052a8e@suse.cz> <20180926061247.GB18685@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180926061247.GB18685@dhcp22.suse.cz> 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 Wed 26-09-18 08:12:47, Michal Hocko wrote: > 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? Hmm, after re-reading your documentation update to "A process mapping may be advised to not be backed by transparent hugepages by either madvise(MADV_NOHUGEPAGE) or prctl(PR_SET_THP_DISABLE)." the implementation matches so scratch my comment. As I've said, I am not happy about this approach but if there is a general agreement this is really the best we can do I will not stand in the way. -- Michal Hocko SUSE Labs