Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp254418pxt; Fri, 6 Aug 2021 00:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7CF4qRsGOIa0xCXIwYjI3l9e+0YSgNhcfUtNZ6DN+earh58uONVU2GMXfp7Wwfnc/kM6B X-Received: by 2002:a05:6402:2297:: with SMTP id cw23mr11242088edb.329.1628236318675; Fri, 06 Aug 2021 00:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628236318; cv=none; d=google.com; s=arc-20160816; b=snt5/5Be77/n6hH4CYagBa+ZfIRIVGzSEAxMFC6d+Heoye/y6PgwOAl9mx5RAveelT dreA+jE9Qww4IRPnbo0JMI/G9GLoNV6c+5SL84HMmYanbvmPEITM6p+Jby0/1orSv4fT 9bJAGwjUnBm6ODeo0SA1w2wVwFJWjOPBVEphKiz8qgmRjPE2xiGl8AnkSdnxK+Cz3IY2 SumP0EwHnujF7HqGBz00C/DLhIadDMgVqUgvtHDzK6lpxdzFs1nDlW3MWBT4QnI3k/Rq VH9hy7sc/Fw0BEtE7LYhbxRx9pWU5V5FJ/15VHRTUxkfNLpL7regnNTjzZxqjzfefFBG 6s2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=nb0tzD291O2NpxD3QkJh5g66mFqozKrq3J7zV5XdneM=; b=cAfd2RmF6JLZnEQ6/+IC9gKsbTljWEEb/Pd2+EdMyBsYdrnYzoF0IfAoBygJ1o4F0C 1hKGq9s9I1NoJM5X6+NJuWbexFqv5VtT1NqQ4GEM3K6EMQnObIVu5bqoic6RFEXMHBfW MJA4mP3cDm2xA33cdgbKsDEhnBBFCzURyBLGxrlR5D/LLfeRGDiJgIR/a1iPL1wGIbyZ +kwIS8LQ054aqZO3RuaxB5utvbgh6qCPRK8Al6n5mERKz5yeWRDMbYPMPe7/KzvZtU/e jgbeh229vHLSBQllEPuMb0fw+Tz83MB0qaz9JvdcCLtoFMLLr8YD2Q6+0+m2Tar9sGcW wGwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tPJQHXxZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht8si7466828ejc.381.2021.08.06.00.51.35; Fri, 06 Aug 2021 00:51:58 -0700 (PDT) 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=@google.com header.s=20161025 header.b=tPJQHXxZ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243125AbhHFFoB (ORCPT + 99 others); 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-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