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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A2E4C433F5 for ; Wed, 13 Oct 2021 12:03:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A8B0460EB4 for ; Wed, 13 Oct 2021 12:03:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A8B0460EB4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3E0C9900002; Wed, 13 Oct 2021 08:03:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 390D26B0071; Wed, 13 Oct 2021 08:03:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A66F900002; Wed, 13 Oct 2021 08:03:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id 1BFA96B006C for ; Wed, 13 Oct 2021 08:03:00 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D8FF01840B38B for ; Wed, 13 Oct 2021 12:02:59 +0000 (UTC) X-FDA: 78691278078.17.5BD8255 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 58D59F000091 for ; Wed, 13 Oct 2021 12:02:59 +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=02qcczvmiTPBk4ptDZ1neiPQwv8s8RqHEA5AhOmIAco=; b=HA3yRevrF7fYlWESRxE76oYSxF 4/lVeYUpyh7cDbMv1BrD9HmogKARDoPyuvC9scK2sApMEVu8jZLOr+AZ3PJldRoS2WFnesRw/7do7 SPZP79RwmvWse/QKhq+wng1vckyx57ljCD72JylKSBwqJge8e14HPxBW30K6nMx/8Dgd41harCx5P 7oxqcCpn58YCkpgVEpKZoo9qdndo8F+LnY34KzWjOAyt/cnH3I8h3reoPOwxg4UPWzHNsYKjUr9DG D22qiqDW2NdrlVHt/RDm7holMhIrK64Agu7grYDKkiUddNmuKKkDFdY0qDfHd6kQdER8ybHG3t5yC 5TUo6WCw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1macx2-007OqE-Qg; Wed, 13 Oct 2021 12:02:10 +0000 Date: Wed, 13 Oct 2021 13:01:40 +0100 From: Matthew Wilcox To: Marek Szyprowski Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , =?utf-8?B?6rmA7ISx7ZuI?= , Song Liu , Rik van Riel , "Kirill A . Shutemov" , Johannes Weiner , Hillf Danton , Hugh Dickins , William Kucharski , Oleg Nesterov , Yang Shi Subject: Re: [PATCH] mm/thp: decrease nr_thps in file's mapping on THP split Message-ID: References: <20211012120237.2600-1-m.szyprowski@samsung.com> <5eafae55-f207-38a8-d6d3-8bda74ae9c60@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5eafae55-f207-38a8-d6d3-8bda74ae9c60@samsung.com> X-Rspamd-Queue-Id: 58D59F000091 X-Stat-Signature: s5ptwe8hmke6ii718ucot7hn8bkahifg Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=HA3yRevr; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1634126579-662009 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, Oct 13, 2021 at 12:47:03PM +0200, Marek Szyprowski wrote: > On 12.10.2021 14:43, Matthew Wilcox wrote: > > On Tue, Oct 12, 2021 at 02:02:37PM +0200, Marek Szyprowski wrote: > >> Decrease nr_thps counter in file's mapping to ensure that the page cache > >> won't be dropped excessively on file write access if page has been > >> already splitted. > >> > >> Signed-off-by: Marek Szyprowski > >> Fixes: 09d91cda0e82 ("mm,thp: avoid writes to file with THP in pagecache") > >> Fixes: 06d3eff62d9d ("mm/thp: fix node page state in split_huge_page_to_list()") > >> --- > >> I've analyzed the code a few times but either I missed something or the > >> nr_thps counter is not decremented during the THP split on non-shmem file > >> pages. > > This looks OK to me, but have you tested it? If so, what workload did > > you use? The way you wrote this changelog makes it sound like you only > > read the code and there have been rather too many bugs introduced recently > > that way :-( > > Well, indeed I've found it while reading the code. However I've just > tried a test scenario, where one runs a big binary, kernel remaps it > with THPs, then one forces THP split with > /sys/kernel/debug/split_huge_pages. During any further open of that > binary with O_RDWR or O_WRITEONLY kernel drops page cache for it, > because of non-zero thps counter. ... and with this patch, it no longer happens? Good enough for me! Acked-by: Matthew Wilcox (Oracle)