Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3384794pxb; Wed, 13 Oct 2021 05:04:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIXlcg6VvIVV4nPyAgjfPQsHs9aj7Tn3jRRWscU57ro06u3NI5OB7t3OttjjE70ZxxKXM1 X-Received: by 2002:a63:6a05:: with SMTP id f5mr27425335pgc.97.1634126682916; Wed, 13 Oct 2021 05:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634126682; cv=none; d=google.com; s=arc-20160816; b=nfDqhhpmxLwKg7DePHlkF+hoOqe98nVw4mqjMOCZKrnMWfeziyXKMjq0EFn4x0xle8 NRL6Fjj4poezrNW+67t6b/Wl/UEuSiqMjUF0dhaLKX3Vy1xr3U/Sn1eMF+5fr0ljVzDF gDGgLNojXUw8P6NgLhjbNaEXYq3fglU5GbgfkTgWElC+zw+YvE0rXib/JljEAVnLRguI FAyXjvrMcNf6JoVcFz2Toqjx7yWMU93wZPwXv3+v32VA5qlpd29SJwUO/j5bcNiRAiJ7 jMJkINDnJZqHSt1khT5P+CcI3GP3m2T0YOoGUOF3lc3gZzuJxYV5v1HcGOC0c2BRvz+H 2W3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=02qcczvmiTPBk4ptDZ1neiPQwv8s8RqHEA5AhOmIAco=; b=q0skauuaRQeMg5qpND046Xd2kYBnxKQkYy4I7Df/HWUxLxf4AFQnQa/HCuKZXd+MGq 2rikfNcKpvQyxNWyudzTqT10RboMDaXaNEMiuYS2KLqgqGD794sTBq3YLP9CBdmTht+J eqLE8PKcKl0qqUoLp7avehQbjx3T7+e0E1okhl6mk6EUPyGlHQWY6c5etq5bzoXTamFD 9Xk3dvFSzeUwL/wCVqeuwDb66cxqtD18xCB8VKzvtlKLDEscLjL0ADoa6I5qFclZQY2+ zIZ1/lGd644/HIGbR6HbpwtPhJIK5QL0yVEFUrmGa2TsjDF6oThPP3rrxXefVG7/kk9Y k2XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HA3yRevr; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si16606564plb.86.2021.10.13.05.04.26; Wed, 13 Oct 2021 05:04:42 -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=@infradead.org header.s=casper.20170209 header.b=HA3yRevr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbhJMMFX (ORCPT + 99 others); Wed, 13 Oct 2021 08:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhJMMFV (ORCPT ); Wed, 13 Oct 2021 08:05:21 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01027C061570 for ; Wed, 13 Oct 2021 05:03:18 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)