Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp209716pxh; Wed, 10 Nov 2021 00:19:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyzhv9tF+mVr02jolh4LcSeBTFM23/mbEr63akyi7/rEdMgoEV8vu+d7OEOoD4wJWg7HQbz X-Received: by 2002:a50:f18c:: with SMTP id x12mr18651883edl.357.1636532357596; Wed, 10 Nov 2021 00:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636532357; cv=none; d=google.com; s=arc-20160816; b=NV/sYyY6MdmkFhSKJre6YgMIkEKwx164X02h03PPAtyqn+WsavUdeS7fx35tqlERCP SZGEPVuLuKbZ4Y0aPjWgZOzNhqTSQmgAe1uFHDiR70gruWf0uqU0+YhOVdlYIxKIq8sd 51/l/hTSuukqZ4ihMuqGqsOEr1FGh35EgdhD0mEfD9EPa4OC50GCAlMJhg0uhok92xEB 7QjagfNPgutoL+Uc04l3UGMYWssacEltTQhQZxUU903z3TaWFw9kvfbl/+utcAF76AkA TitxuGuEq92A3G4Hm3KEgsjGVW7yiCtf9W1rOWvakhQt4pdD4taYjUQbm5ttcu/8sIkk QWNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=VRNRQyUTnzlLVnEZtE2AkClya4QUFn8/IlNw/XyFTA0=; b=chRrPij1BeJHMFYe6akneP803mvMlW8LoTmEo55nL7+cnaM0wJ0rVIuMhBBlKyPjTt Ubm4/qRtSmwx0smGnPl7MJgisoNpEJ0D+a0rs6fyX5coahHD1pTXfi1B8D7F4CPEULlN 6CBVwgCFblddPgoDt6WHGygwwb7Ny5TGB2fpG56tOtdF4YJiVVrQpH9ThXHEQaaQdkQv udLDuSzbNisoIJf8Y0vZgRotMyZSyXwdob3pdjwii3OR5fDnCzM9HewxB5ClCA8GKq5c Y+kpYnawxT4f74HPldMPmU1R0p/Zxv7QmG6FfE75iZ37LyfnRG8O87W15mSVkIWua5QH IKDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XqOptqSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s1si35065265edi.608.2021.11.10.00.18.53; Wed, 10 Nov 2021 00:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XqOptqSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbhKJIRe (ORCPT + 99 others); Wed, 10 Nov 2021 03:17:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42251 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbhKJIRe (ORCPT ); Wed, 10 Nov 2021 03:17:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636532086; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VRNRQyUTnzlLVnEZtE2AkClya4QUFn8/IlNw/XyFTA0=; b=XqOptqSLZ/k6W4kLXIDH6RZKPKVV4P5MT5XLjAS0Ac5W93BF8sQpB+oJMV/DB6a7kRHU04 +wqJGD+PifEcFEOQLbE7ChAddtIYAA29T3ZgmOpVXlkFmdW5kS9SJ1tReIhb8O9BUFPuvR Hu8CtC/asipBzWjNLwqijdjMWEnzvjU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-xfgF3Xf3MNqE6bNxSp0I7g-1; Wed, 10 Nov 2021 03:14:45 -0500 X-MC-Unique: xfgF3Xf3MNqE6bNxSp0I7g-1 Received: by mail-wr1-f71.google.com with SMTP id v18-20020a5d5912000000b001815910d2c0so226557wrd.1 for ; Wed, 10 Nov 2021 00:14:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=VRNRQyUTnzlLVnEZtE2AkClya4QUFn8/IlNw/XyFTA0=; b=khnCWANFs9KO+um6HsorkD2S1ivjRrUlI9S6Sg6y02S26gdjSME9YuMYpOf4OgsTRG QVOhzc8y90w4AZ++u1i6dAOirDT9Px22xBR1l20W373VeGUZ8+1kLY8r5coneulQaa6j RZeStZKUL+DgrBdi9Ph4ySBXpqIIU37NFnYyhnl5mESVOb2z/8JdQOpDppSlIrMivndI n7tbUjQT1YY6dCTSF+KOGQw6X7HVaG9NcnzO4Na2lIUrGJAX4UJ9oGIO6m5CKU52P3/i bgd4g1WmMuoXDfl6LBTPWZDGPUzRqeZvmMl58PvNLBzx8LYVo4XPtzyvD7PUPNmCbXF5 TzrA== X-Gm-Message-State: AOAM531h0mJlR0Rq6dHP8J4eIf0hCGCZ7KAEISw8hQiKmbSMMVfpjdZa 6kYy3TwTSwRcSuD+guq3xUYtedTOsz6f80aW8I3hpi4MBNDG7wnkLs9+zautHpw68YPdGjtQPTk RMJszxyVH//LO3Mu8/gxdQMAb X-Received: by 2002:a5d:584c:: with SMTP id i12mr17905131wrf.95.1636532084435; Wed, 10 Nov 2021 00:14:44 -0800 (PST) X-Received: by 2002:a5d:584c:: with SMTP id i12mr17905107wrf.95.1636532084265; Wed, 10 Nov 2021 00:14:44 -0800 (PST) Received: from [192.168.3.132] (p5b0c604f.dip0.t-ipconnect.de. [91.12.96.79]) by smtp.gmail.com with ESMTPSA id z6sm22659735wrm.93.2021.11.10.00.14.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Nov 2021 00:14:43 -0800 (PST) Message-ID: Date: Wed, 10 Nov 2021 09:14:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v4] mm: Add PM_HUGE_THP_MAPPING to /proc/pid/pagemap Content-Language: en-US To: Peter Xu , Mina Almasry Cc: Matthew Wilcox , "Paul E . McKenney" , Yu Zhao , Jonathan Corbet , Andrew Morton , Ivan Teterevkov , Florian Schmidt , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20211107235754.1395488-1-almasrymina@google.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10.11.21 08:03, Peter Xu wrote: > Hi, Mina, > > Sorry to comment late. > > On Sun, Nov 07, 2021 at 03:57:54PM -0800, Mina Almasry wrote: >> diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst >> index fdc19fbc10839..8a0f0064ff336 100644 >> --- a/Documentation/admin-guide/mm/pagemap.rst >> +++ b/Documentation/admin-guide/mm/pagemap.rst >> @@ -23,7 +23,8 @@ There are four components to pagemap: >> * Bit 56 page exclusively mapped (since 4.2) >> * Bit 57 pte is uffd-wp write-protected (since 5.13) (see >> :ref:`Documentation/admin-guide/mm/userfaultfd.rst `) >> - * Bits 57-60 zero >> + * Bit 58 page is a huge (PMD size) THP mapping >> + * Bits 59-60 zero >> * Bit 61 page is file-page or shared-anon (since 3.5) >> * Bit 62 page swapped >> * Bit 63 page present >> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c >> index ad667dbc96f5c..6f1403f83b310 100644 >> --- a/fs/proc/task_mmu.c >> +++ b/fs/proc/task_mmu.c >> @@ -1302,6 +1302,7 @@ struct pagemapread { >> #define PM_SOFT_DIRTY BIT_ULL(55) >> #define PM_MMAP_EXCLUSIVE BIT_ULL(56) >> #define PM_UFFD_WP BIT_ULL(57) >> +#define PM_HUGE_THP_MAPPING BIT_ULL(58) > > The ending "_MAPPING" seems redundant to me, how about just call it "PM_THP" or > "PM_HUGE" (as THP also means HUGE already)? > > IMHO the core problem is about permission controls, and it seems to me we're > actually trying to workaround it by duplicating some information we have.. so > it's kind of a pity. Totally not against this patch, but imho it'll be nicer > if it's the permission part that to be enhanced, rather than a new but slightly > duplicated interface. It's not a permission problem AFAIKS: even with permissions "changed", any attempt to use /proc/kpageflags is just racy. Let's not go down that path, it's really the wrong mechanism to export to random userspace. We do have an interface to access this information from userspace already: /proc/self/smaps IIRC. Mina commented that they are seeing performance issues with that approach. It would be valuable to add these details to the patch description, including a performance difference when using both interfaces we have available. As the patch description stands, there is no explanation "why" we want this change. -- Thanks, David / dhildenb