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=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 29B2AC4363D for ; Tue, 20 Oct 2020 13:39:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67CE421741 for ; Tue, 20 Oct 2020 13:39:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YzJzXfXh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67CE421741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9A37A6B006C; Tue, 20 Oct 2020 09:39:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 979FE6B006E; Tue, 20 Oct 2020 09:39:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8417F6B0070; Tue, 20 Oct 2020 09:39:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 5784C6B006C for ; Tue, 20 Oct 2020 09:39:03 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E5B07181AEF15 for ; Tue, 20 Oct 2020 13:39:02 +0000 (UTC) X-FDA: 77392409724.05.trail87_270835127240 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id C6EB618017BF1 for ; Tue, 20 Oct 2020 13:39:02 +0000 (UTC) X-HE-Tag: trail87_270835127240 X-Filterd-Recvd-Size: 5482 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 13:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603201141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VQMvJLX2BrM7Ofm/MK81zOtT07moMREVSxUbza9t1T8=; b=YzJzXfXhzb249/3w2MY4Kg8b6NAxUW5iNUiCEF6BN1GVi5J8HdDCViIMGO3K/mpHRBJ0Ae 8T0oEK4JvbLxau43QgCAIA8WFerVyQZv97ZSxK7+ApXrO5HRYj7E+i3PTyPu7CyPmqTBmW V8ygebW2G1kotr9C40n4HdBrtgfE/bA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-414-yeLC_vgmOsOZJqBBgaZjPg-1; Tue, 20 Oct 2020 09:38:59 -0400 X-MC-Unique: yeLC_vgmOsOZJqBBgaZjPg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4473A1006C8A; Tue, 20 Oct 2020 13:38:58 +0000 (UTC) Received: from [10.36.114.141] (ovpn-114-141.ams2.redhat.com [10.36.114.141]) by smtp.corp.redhat.com (Postfix) with ESMTP id 841FA5C1C2; Tue, 20 Oct 2020 13:38:53 +0000 (UTC) Subject: Re: cgroup and FALLOC_FL_PUNCH_HOLE: WARNING: CPU: 13 PID: 2438 at mm/page_counter.c:57 page_counter_uncharge+0x4b/0x5 To: Mike Kravetz , Mina Almasry Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Michal Privoznik , "Michael S. Tsirkin" , Michal Hocko , Muchun Song , "Aneesh Kumar K.V" , Tejun Heo References: <563d1eef-b780-835a-ebf0-88ae111b20c2@redhat.com> <65a1946f-dbf9-5767-5b51-9c1b786051d1@redhat.com> <5f196069-8b98-0ad3-55e8-19af03d715cd@oracle.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Tue, 20 Oct 2020 15:38:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 16.10.20 01:14, Mike Kravetz wrote: > On 10/14/20 11:31 AM, Mike Kravetz wrote: >> On 10/14/20 11:18 AM, David Hildenbrand wrote: >> >> FWIW - I ran libhugetlbfs tests which do a bunch of hole punching >> with (and without) hugetlb controller enabled and did not see this issue. >> > > I took a closer look after running just the fallocate_stress test > in libhugetlbfs. Here are the cgroup counter values: > > hugetlb.2MB.failcnt 0 > hugetlb.2MB.limit_in_bytes 9223372036854771712 > hugetlb.2MB.max_usage_in_bytes 209715200 > hugetlb.2MB.rsvd.failcnt 0 > hugetlb.2MB.rsvd.limit_in_bytes 9223372036854771712 > hugetlb.2MB.rsvd.max_usage_in_bytes 601882624 > hugetlb.2MB.rsvd.usage_in_bytes 392167424 > hugetlb.2MB.usage_in_bytes 0 > > We did not hit the WARN_ON_ONCE(), but the 'rsvd.usage_in_bytes' value > is not correct in that it should be zero. No huge page reservations > remain after the test. > > HugePages_Total: 1024 > HugePages_Free: 1024 > HugePages_Rsvd: 0 > HugePages_Surp: 0 > Hugepagesize: 2048 kB > Hugetlb: 2097152 kB > > To try and better understand the reservation cgroup controller, I addded > a few printks to the code. While running fallocate_stress with the > printks, I can consistently hit the WARN_ON_ONCE() due to the counter > going negative. Here are the cgroup counter values after such a run: > > hugetlb.2MB.failcnt 0 > hugetlb.2MB.limit_in_bytes 9223372036854771712 > hugetlb.2MB.max_usage_in_bytes 209715200 > hugetlb.2MB.rsvd.failcnt 3 > hugetlb.2MB.rsvd.limit_in_bytes 9223372036854771712 > hugetlb.2MB.rsvd.max_usage_in_bytes 251658240 > hugetlb.2MB.rsvd.usage_in_bytes 18446744073487253504 > hugetlb.2MB.usage_in_bytes 0 > > Again, no reserved pages after the test. > > HugePages_Total: 1024 > HugePages_Free: 1024 > HugePages_Rsvd: 0 > HugePages_Surp: 0 > Hugepagesize: 2048 kB > Hugetlb: 2097152 kB > > I have some basic hugetlb hole punch functionality tests. Running > these on the kernel with added printk's does not cause any issues. > In order to reproduce, I need to run fallocate_stress test which > will cause hole punch to race with page fault. Best guess at this > time is that some of the error/race detection reservation back out > code is not properly dealing with cgroup accounting. > > I'll take a look at this as well. > I'm bisecting the warning right now. Looks like it was introduced in v5.7. -- Thanks, David / dhildenb