Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp373244rwb; Thu, 27 Jul 2023 14:14:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbF8r5bIceayuKlzwcDkXntV4WDa5Li0BtmNNxM9kd1HAIXnAKZskJKES0PQ18/2RDVNWD X-Received: by 2002:aca:1318:0:b0:3a3:7977:8995 with SMTP id e24-20020aca1318000000b003a379778995mr407053oii.47.1690492484363; Thu, 27 Jul 2023 14:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690492484; cv=none; d=google.com; s=arc-20160816; b=0pFMv82NbX8BoFrHLYSg/Q0msSinm0XvP8WyzfB3zpYsgD6zhtwRh0bUQ+PIU6jz9P CAeq/NHkM7O2H8dk8akA7gR/tEXi8HeHHeaX5CfbYGlW3HWoo/TOXZx87hKkctUObqR8 P5PJ8CfpbApfjCn4ahmUqOUrcBSmFHfuwJNAnfoNVu3892GvXse5kDcAVV7OcFYbX4so mSwEf43uX5x9h4cMx6otq/xgPfUX9nGM88yOAgnnUAJs9t21mIAPI5KTKVxwGZIigFtP ggGaeQKpATSou3Ba7YjcHl0/JCXV6I09JlN2hyPXPZ8WAL0BVpWM2WfxgvLl0KaEYjPv 9H6w== 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=lfWu2ZSOpTuxqffZRsnr4zvcADBC5ezgXzbU6lFturo=; fh=zMFvIk0YgVUDfTXvRfrpSWJvKzlr4xZWkau8ISv+PNs=; b=Xg8XSPNbLrDM1Ps+XbSWZeAnY9QC3daTW5/bGNTgPls963gf4VXMjcY79CIHi1nMk6 MfnTnDEH/3Y/SnHVkNzr6K30kUuc9wT4oWmz9mBagy73xmZRfyImmxxrVrFFsqPzlUlU cbOsTguSg95wW6DqY2dx6Ph63Z9PA3hVHYlwqGYfeJUWHrx1Hlnyn0db/n5MrwsWcc3B IwMGRy+V6wKrjqblerV/1YjefOJdu2d0kPlEq8HoHy1W5mM6DXTPB4ITusW3NEvETw/i 4hSWFF6TTI1ztLVpInopvgB6bi9xmQVHeATwiwg9om250UeZ4AZ3i2s8NQvUFV0Xw8yz 4G2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nqrxo9OY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a63f508000000b0055b51ed5798si1739903pgh.187.2023.07.27.14.14.31; Thu, 27 Jul 2023 14:14:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nqrxo9OY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231777AbjG0UoV (ORCPT + 99 others); Thu, 27 Jul 2023 16:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjG0UoS (ORCPT ); Thu, 27 Jul 2023 16:44:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B845C2D45 for ; Thu, 27 Jul 2023 13:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690490611; 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=lfWu2ZSOpTuxqffZRsnr4zvcADBC5ezgXzbU6lFturo=; b=Nqrxo9OYCUYEnYxm97rdc6HxbuEtMg7nff3j7U2SuJnwCgMYyKdNeEfyVbg6904B1O4IKY OUr9ws9dkhv1PkrHOJNMKBa4WGfaY4sqVYdkF56RXoqTq8jQ9Tj08k0ctU3cn2IPBZF7Ni NTIUMnjqUKM1npErAEkje1zIaZmZE5Q= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-Z11W_rKdM_W4QXsrxB9WMg-1; Thu, 27 Jul 2023 16:43:30 -0400 X-MC-Unique: Z11W_rKdM_W4QXsrxB9WMg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fbe590234aso7450605e9.1 for ; Thu, 27 Jul 2023 13:43:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690490609; x=1691095409; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lfWu2ZSOpTuxqffZRsnr4zvcADBC5ezgXzbU6lFturo=; b=j4XmlCPDmhBe6/KpqEOafZewrM+yYx4sXENuKFuABgAMR8UrsokuwatRCEU0qlQYMX 1EUJWeTuB0tcVw5MNXgzVt8LjnMGMgOGyWR9VY0ZoaG30HPAhvImdmBNlsggZ9l3gaE3 7/sAZRszcjYBpBrpA3+bTfDrPP2WpiLqNy0DK+Vp/cPhXPR+oDnwtw6jqGMjVezqzu1n A2jFgaEtqzNcHLy3a7aapVhbDRNteGl789iFVc2SORvB8CeTQQD0a1zgz6P7rYegtRzh ZIdJANgDoGn6p8OXUB59TSEmY/YGZrLufEMg8c5eHDnoGjkaWzSmTlYGNiugaU8mfZPb k0HQ== X-Gm-Message-State: ABy/qLaAx73mVj7LzovBJ+/O4PA6AxVfbNx809bUw3sVuog5z3H28ohm amzNYPf1hJK419/HKcCIQNmqNUUkyzfTKmc3HY0Gvisoxra2SpPeB3vaMT+HUAJDoho5a44dOIS Au3ORMXZqcKBdGF76y1cw7NsQ X-Received: by 2002:adf:e4c1:0:b0:317:631b:43ce with SMTP id v1-20020adfe4c1000000b00317631b43cemr211124wrm.41.1690490609102; Thu, 27 Jul 2023 13:43:29 -0700 (PDT) X-Received: by 2002:adf:e4c1:0:b0:317:631b:43ce with SMTP id v1-20020adfe4c1000000b00317631b43cemr211115wrm.41.1690490608705; Thu, 27 Jul 2023 13:43:28 -0700 (PDT) Received: from ?IPV6:2003:d8:2f43:4700:d2cd:2b81:d4e6:8b2a? (p200300d82f434700d2cd2b81d4e68b2a.dip0.t-ipconnect.de. [2003:d8:2f43:4700:d2cd:2b81:d4e6:8b2a]) by smtp.gmail.com with ESMTPSA id m12-20020adff38c000000b00313f031876esm2985542wro.43.2023.07.27.13.43.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jul 2023 13:43:28 -0700 (PDT) Message-ID: <818a2511-5eed-7c29-b52f-1cab2bd40434@redhat.com> Date: Thu, 27 Jul 2023 22:43:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] smaps: Fix the abnormal memory statistics obtained through /proc/pid/smaps Content-Language: en-US To: Peter Xu Cc: liubo , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hughd@google.com, willy@infradead.org References: <20230726073409.631838-1-liubo254@huawei.com> <5a2c9ae4-50f5-3301-3b50-f57026e1f8e8@redhat.com> <30e58727-0a6a-4461-e9b1-f64d6eea026c@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.07.23 22:30, Peter Xu wrote: > On Thu, Jul 27, 2023 at 09:17:45PM +0200, David Hildenbrand wrote: >> On 27.07.23 20:59, Peter Xu wrote: >>> On Thu, Jul 27, 2023 at 07:27:02PM +0200, David Hildenbrand wrote: >>>>>> >>>>>> This was wrong from the very start. If we're not in GUP, we shouldn't call >>>>>> GUP functions. >>>>> >>>>> My understanding is !GET && !PIN is also called gup.. otherwise we don't >>>>> need GET and it can just be always implied. >>>> >>>> That's not the point. The point is that _arbitrary_ code shouldn't call into >>>> GUP internal helper functions, where they bypass, for example, any sanity >>>> checks. >>> >>> What's the sanity checks that you're referring to? >>> >> >> For example in follow_page() >> >> if (vma_is_secretmem(vma)) >> return NULL; >> >> if (WARN_ON_ONCE(foll_flags & FOLL_PIN)) >> return NULL; >> >> >> Maybe you can elaborate why you think we should *not* be using >> vm_normal_page_pmd() and instead some arbitrary GUP internal helper? I don't >> get it. > > Because the old code was written like that? And it's not 2014 anymore. Nowadays we do have the right helper in place. [...] >> FOLL_NUMA naming was nowadays wrong to begin with (not to mention, confusing >> a we learned). There are other reasons why we have PROT_NONE -- mprotect(), >> for example. > > It doesn't really violate with the name, IMHO - protnone can be either numa > hint or PROT_NONE for real. As long as we return NULL for a FOLL_NUMA > request we're achieving the goal we want - we guarantee a NUMA balancing to > trigger with when FOLL_NUMA provided. It doesn't need to guarantee > anything else, afaiu. The final check relies in vma_is_accessible() in the > fault paths anyway. So I don't blame the old name that much. IMHO, the name FOLL_NUMA made sense when it still was called pte_numa. > >> >> We could have a flag that goes the other way around: FOLL_IGNORE_PROTNONE >> ... which surprisingly then ends up being exactly what FOLL_FORCE means >> without FOLL_WRITE, and what this patch does. >> >> Does that make sense to you? >> >> >>> >>> The very least is if with above we should really document FOLL_FORCE - we >>> should mention NUMA effects. But that's ... really confusing. Thinking >>> about that I personally prefer a revival of FOLL_NUMA, then smaps issue all >>> go away. >> >> smaps needs to be changed in any case IMHO. And I'm absolutely not in favor >> of revicing FOLL_NUMA. > > As stated above, to me FOLL_NUMA is all fine and clear. If you think > having a flag back for protnone is worthwhile no matter as-is (FOLL_NUMA) > or with reverted meaning, then that sounds all fine to me. Maybe the old > name at least makes old developers know what's that. > > I don't have a strong opinion on names though; mostly never had. I'll avoid new FOLL_ flags first and post my proposal. If many people are unhappy with that approach, we can revert the commit and call it a day. Thanks! -- Cheers, David / dhildenb