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=-11.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 DC438C4727E for ; Wed, 30 Sep 2020 12:13:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 114D8206B7 for ; Wed, 30 Sep 2020 12:13:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XjfDIHWC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 114D8206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5B4A66B0068; Wed, 30 Sep 2020 08:13:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 564D78E0001; Wed, 30 Sep 2020 08:13:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47AC06B006E; Wed, 30 Sep 2020 08:13:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 2FE016B0068 for ; Wed, 30 Sep 2020 08:13:26 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D81E618023EBB for ; Wed, 30 Sep 2020 12:13:25 +0000 (UTC) X-FDA: 77319617970.18.boat51_0a1849227192 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id B2D451014CA06 for ; Wed, 30 Sep 2020 12:13:25 +0000 (UTC) X-HE-Tag: boat51_0a1849227192 X-Filterd-Recvd-Size: 4512 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 12:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=I3qA4Z0zqSef8ueiLP6cVrqeoP4tvNdCxHz8kOAlUQI=; b=XjfDIHWCnN3EzYFvoqztvnJ7C6 2vbyIIhMlfH30bZcilBwWiNhIq+5gh+7jIv8tzTj/1pn0lgbzZowhKyAWGywN+wII6MbsopTjf2KZ 9qYRG3EefkkpQ7Od1Vp7v8X2aZ3xxKUBPuLAdle/lt4MF4CrfdN7lVVx8mufgvvAYhHLxRNoqI6YS /DQxLtt6QQHtU4CZrcxeR7kCvMCt0rwUmu1YekXDEaXrMVoOYGlffPF5OlEjnoTPZge49cBpmIcpy x793bgxdbNNAIKzElk0SM45Ygvos6pwaHs+351sEKIJXVysP2oXQsPBgN29W5BUZDyJDY5WjeAMq8 uvY/DFQA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNayw-0001Ek-NG; Wed, 30 Sep 2020 12:13:14 +0000 Date: Wed, 30 Sep 2020 13:13:14 +0100 From: Matthew Wilcox To: "Huang, Ying" Cc: SeongJae Park , linux-mm@kvack.org, Andrew Morton , "Kirill A . Shutemov" Subject: Re: [PATCH 11/11] mm/vmscan: Allow arbitrary sized pages to be paged out Message-ID: <20200930121314.GO20115@casper.infradead.org> References: <20200908195539.25896-12-willy@infradead.org> <20200915074045.17570-1-sjpark@amazon.com> <20200915125213.GB5449@casper.infradead.org> <87363its79.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87363its79.fsf@yhuang-dev.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 16, 2020 at 09:40:10AM +0800, Huang, Ying wrote: > Matthew Wilcox writes: > > On Tue, Sep 15, 2020 at 09:40:45AM +0200, SeongJae Park wrote: > >> On Tue, 8 Sep 2020 20:55:38 +0100 "Matthew Wilcox (Oracle)" wrote: > >> > Remove the assumption that a compound page has HPAGE_PMD_NR pins from > >> > the page cache. > >> > > >> > Signed-off-by: Matthew Wilcox (Oracle) > >> > Cc: Huang Ying > > > >> > - int page_cache_pins = PageTransHuge(page) && PageSwapCache(page) ? > >> > - HPAGE_PMD_NR : 1; > >> > + int page_cache_pins = thp_nr_pages(page); > >> > >> Is it ok to remove the PageSwapCache() check? > > > > I think so? My understanding is that it was added in commit bd4c82c22c36 > > to catch shmem pages, but there was really no reason to only do this for > > shmem pages. > > The original implementation is to write out Anonymous THP (not shmem). > The code should work after the changing, because now any THP except > normal Anonymous THP in swap cache will be split during reclaiming > already. Actually, that's a problem I just hit. Simple to reproduce: git clone git://git.infradead.org/users/willy/pagecache.git build it, boot it: mkdir /mnt/scratch; mkfs.xfs /dev/sdb; mount /dev/sdb /mnt/scratch/; dd if=/dev/zero of=/mnt/scratch/bigfile count=2000 bs=1M; umount /mnt/scratch/; mount /dev/sdb /mnt/scratch/; cat /mnt/scratch/bigfile >/dev/null (the virtual machine i'm using only has 2GB of memory so this forces vmscan to happen). Anyway, we quickly run into OOM and get this kind of report: active_anon:307 inactive_anon:4137 isolated_anon:0 active_file:0 inactive_file:436964 isolated_file:192 unevictable:0 dirty:0 writeback:0 slab_reclaimable:3774 slab_unreclaimable:4132 mapped:40 shmem:320 pagetables:167 bounce:0 free:24315 free_pcp:0 free_cma:0 A little debugging shows split_huge_page_to_list() is failing because the page still has page_private set, so the refcount is one higher than expected. This patch makes the problem go away: @@ -1271,10 +1271,6 @@ static unsigned int shrink_page_list(struct list_head *page_list, /* Adding to swap updated mapping */ mapping = page_mapping(page); } - } else if (unlikely(PageTransHuge(page))) { - /* Split file THP */ - if (split_huge_page_to_list(page, page_list)) - goto keep_locked; } /* but I'm not sure what that's going to do to tmpfs/swap. Could you guide me here?