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=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 03F0AC432BE for ; Fri, 6 Aug 2021 05:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D383E60EB2 for ; Fri, 6 Aug 2021 05:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243162AbhHFFoB (ORCPT ); Fri, 6 Aug 2021 01:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241468AbhHFFn6 (ORCPT ); Fri, 6 Aug 2021 01:43:58 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A04EC06179A for ; Thu, 5 Aug 2021 22:43:42 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id 14so8806989qkc.4 for ; Thu, 05 Aug 2021 22:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=nb0tzD291O2NpxD3QkJh5g66mFqozKrq3J7zV5XdneM=; b=tPJQHXxZd9eovODzKBrQ7Z1rQFYYNBRweevMY3p3T4d+8apkd/mZ4TyiXxYdN5oBHu +XFAycB1FnQvzN1zYjFLP5xEqwa6Lz90VqwX3n+BQPHkjfdn5gEk1NigAvwe9fXlD9SE dS8tKra0w06ivJObMdFJ5EFEZhWLYXTvRc4kZiH0MbWzpk2ETptYZEtSqKyavpv2dLJr zClQiwX0qS9s/UburEei25PU/qGv02H+kF28+HWanfBfj27acFef+4JzJA3Wic9Nrwxp 3xP1iJS5I0CYcBXgt9BGW6QPmuvSkHWUfkH/I9YOJXzCmWCKUTUQ86xrJrhkLbC+Mi5Y 4rMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=nb0tzD291O2NpxD3QkJh5g66mFqozKrq3J7zV5XdneM=; b=BoJSQdqojcbUmm4ayWqM3lCkjDU/OPZ5WjNEUpVaSv4bwitoadyWK8Cj/TQWHCa9YO SRrCiMHPxDXlzPOnnEjM4EyjuqbcrzVgZOpwcsuYDix+zngYih0cDo1P+JLg/fVWSER/ C1pBdZv7UqiBv62HJrUNoXfpIgvz3CQRxsdr4wAS2K718bnn8JMwX3160a5qzWrsL07r 9uR1FvgwEvPBjgwG4d75zijidB6mpX8YZpUd5WiNLGgHa43JgrwqD3QDOEF3iesBRTws kzoKFHtrJ/TkcvCUFQqW+Ynv9CICJOaUMEm8mORj/niDxxrL3NYkWj1Pat/6WQaKIuBf U01A== X-Gm-Message-State: AOAM530eMQ62IEEp8tjP22lp+6h5ovySpEVVBObUTAAWfNe6619DYk0H T88hPrTof/1WomaBPgX7wl7/DQ== X-Google-Smtp-Source: ABdhPJwEfynqWrtytJi7KqnkQzjUoNcTR3OSX0gNN/t9rR4rDc5rHaI5jc76FJ1/rG7ENL+FdWpl4w== X-Received: by 2002:a37:5a02:: with SMTP id o2mr8487795qkb.476.1628228621102; Thu, 05 Aug 2021 22:43:41 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id g4sm3970818qkk.104.2021.08.05.22.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 22:43:40 -0700 (PDT) Date: Thu, 5 Aug 2021 22:43:37 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Yang Shi cc: Hugh Dickins , Andrew Morton , Shakeel Butt , "Kirill A. Shutemov" , Miaohe Lin , Mike Kravetz , Michal Hocko , Rik van Riel , Christoph Hellwig , Matthew Wilcox , "Eric W. Biederman" , Alexey Gladkov , Chris Wilson , Matthew Auld , Linux FS-devel Mailing List , Linux Kernel Mailing List , linux-api@vger.kernel.org, Linux MM Subject: Re: [PATCH 06/16] huge tmpfs: shmem_is_huge(vma, inode, index) In-Reply-To: Message-ID: <749bcf72-efbd-d6c-db30-e9ff98242390@google.com> References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 Aug 2021, Yang Shi wrote: > > By rereading the code, I think you are correct. Both cases do work > correctly without leaking. And the !CONFIG_NUMA case may carry the > huge page indefinitely. > > I think it is because khugepaged may collapse memory for another NUMA > node in the next loop, so it doesn't make too much sense to carry the > huge page, but it may be an optimization for !CONFIG_NUMA case. Yes, that is its intention. > > However, as I mentioned in earlier email the new pcp implementation > could cache THP now, so we might not need keep this convoluted logic > anymore. Just free the page if collapse is failed then re-allocate > THP. The carried THP might improve the success rate a little bit but I > doubt how noticeable it would be, may be not worth for the extra > complexity at all. It would be great if the new pcp implementation is good enough to get rid of khugepaged's confusing NUMA=y/NUMA=n differences; and all the *hpage stuff too, I hope. That would be a welcome cleanup. > > > Collapse failure is not uncommon and leaking huge pages gets noticed. After writing that, I realized how I'm almost always testing a NUMA=y kernel (though on non-NUMA machines), and seldom try the NUMA=n build. So did so to check no leak, indeed; but was surprised, when comparing vmstats, that the NUMA=n run had done 5 times as much thp_collapse_alloc as the NUMA=y run. I've merely made a note to look into that one day: maybe it was just a one-off oddity, or maybe the incrementing of stats is wrong down one path or the other. Hugh