Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp716713lqt; Fri, 19 Apr 2024 08:23:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWx1H95bg8+Ox0yD9RWupLLkKBX55IDPTZpYQeLq7r/AQWxgrygkHw6aNxsjlEE8BsPsHG0zepHRZzAAcnwhgka7tOlg2yI9dduJjSQgQ== X-Google-Smtp-Source: AGHT+IE1TU9U5chwQI6jqN5oTAA3DQzxhavIGkSE78Pfa2OD4wGesk/Fbz2R7Ok+ohNWBuQZQD26 X-Received: by 2002:a05:6a20:438e:b0:1aa:a421:43eb with SMTP id i14-20020a056a20438e00b001aaa42143ebmr2990498pzl.14.1713540196902; Fri, 19 Apr 2024 08:23:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713540196; cv=pass; d=google.com; s=arc-20160816; b=XOau31XsBpfd2sjlrkWlljFX9Z3DyV3MfPUOA+Ku8cyjzh4TkePNzyM9cNWtVq1+bk XmsswLnoGcHRy//C8l3m9r2/s9KguDPON9zdMHlyooET+Dy9KDDROiil2QAa/M/kZvbd 3eR6Rj/xVaB/FNpz8SFaoz+8mrJk47s4hapwPZNdXIdpWyAszcsH5DCoRlkdpIb1kPW5 QBthYrYVqFXvg2fg3slRPYwTZjl2Ihfp1ykj2gWX98fe0ACBgKn+AmrOwfhPAKgY+E5V FEePAELV9b3QKrU9Rw6YAZyaSUa+jf5WLxu8+pWZE+ASgcM9l5UGN2/GYdaI60iROoBU Kduw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XYoEcbDndyhCownGWpj006Efk7M0aOxnlzP6C0Hoi1o=; fh=WWy+IfqPgFNaiCzAhmFzSzgn8Y4I4dJR3d28nEMzEhk=; b=HK+NwHzzL5URu4+UbdxJff7E8RB6S2Ey9h+IaFDAjOc7AvmV/GKrxK5Kl1CyjIp+3h zc7UCDQtjxftJMnVDsGNfNd4jCVg8EKARoYbGDWpYO9ivsweEHTzH0EqRMpqYsKzWcUJ MLYJE/gjXoeEsOD5ppkKDT5SbT+9eIK6kMOi1dk5+hMP5MmuNMwZ7Dn1HuhFymrfOkyd ob1EdJhuFAK0CP6wQaM27awmeEAjeU9Sda2NunlyoHdREKZLsIzKdEOL0L156A9akzXZ 0ByayDqxM8zyqjCCVez2kncsKWtLvmOBAT35QgQZ7b5U/g/wcHjiffjnk5P3AsivJrqp nR8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CqGCGbjl; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-151660-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y9-20020a056a00038900b006ed1e92a81bsi3316774pfs.365.2024.04.19.08.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:23:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151660-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CqGCGbjl; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-151660-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA7DF281D31 for ; Fri, 19 Apr 2024 15:22:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A06112F5B2; Fri, 19 Apr 2024 15:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CqGCGbjl" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04B1D12F5AE for ; Fri, 19 Apr 2024 15:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713540125; cv=none; b=rfER0BNF16tBNei3iISqIXzinTmFMJBaJVJpHjHU5F4DcX29LiD/6w4y/wbd7IE4xywIS+qLRajon7e458bTD0ouJ/vJcrjneSHs0Yszbtu7du9JPKF1ikhS+xz4Rk9dw37Agz3UD7WMWUB8y/lswSBfHEMFZ4sTc6/VHGQZa5w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713540125; c=relaxed/simple; bh=MJGoZTVpjtviiVYwoZxi+ES4Zin/KP+7Zanoc63PsIY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DMbv0Mo1PAG/wRQMwPqIvZSF27lxYQMh15nA5nC8ThTU2QXCDf5sBPKfMnJWzWVIZb9wxuqNVIOdhVAqWLlKFYdUe28KGHY1M76LarpVt0yLUm1YqCYUAOyPnB8G0fajxtUq6xLSAru+4Jui/dVWzWzz41q7wtGPIJ9DsxaTAxI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CqGCGbjl; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713540123; 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=XYoEcbDndyhCownGWpj006Efk7M0aOxnlzP6C0Hoi1o=; b=CqGCGbjl+Dip8jROrPhE507Tskggu9IoTyHNA5/vsLz7EtSoy5IZKLE56wH5J5pkJOC8B/ zip3WDIlmV/E6IyPpjBZiJRE7SKVcIRL91+RXEaTedkI2esHqKa97x1TSqgPKT0NyzBsut 7stBC6+fuOkgmVAlIu4aV6DWnX5Fbhs= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-1-RR6fVeNIukpkDih73Vig-1; Fri, 19 Apr 2024 11:22:01 -0400 X-MC-Unique: 1-RR6fVeNIukpkDih73Vig-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6ebc82e112bso552141a34.1 for ; Fri, 19 Apr 2024 08:22:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713540121; x=1714144921; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XYoEcbDndyhCownGWpj006Efk7M0aOxnlzP6C0Hoi1o=; b=vs84T9VAfXDPNeNqdHe21YtTnk/gqaL9Wz5cTVVO/mstO7s1sWP606xYGYo34AFx+X Sk7K4WL2i59Z7jz8VfF8qoCW3iLyf0a0bOhKlOcdgorUglkCabcJBRjkkSQNQ89xU4MD P94QANIwY+b7AIg7ardR3Zh361UQStTeALYOQh5qvUiUvRCiQ2trf/ZZc50CFUQy3ARR 23OwcdpPPAg24eVd6xgZXAedlTqL+3S2UBFcqNeDQXgMOiJacBo+klAi1aDt3FbPAYzA ODnFJuN7VRdH0oIs/j8f0SZA5i9Yd8vdJSjR8yLcd60A04GWGhDafRGHK8jHDtufvuc/ zrAw== X-Forwarded-Encrypted: i=1; AJvYcCWVtQ7YCAIxTPQxxjJCPzW6XjwLD2HJh+LKD9uRe+cZvgNe/RZD24F/WIfR7WVCNi2tLz01PQY8EnzmTGcr/XctzqSGSvaBnzk9T0JD X-Gm-Message-State: AOJu0Yxr0YQjlFIWGacbupuMI0YB9OXQU7Mt5Vq+XcJ+bCVMewG2ytx+ PsDY0c/utMXdh9obQJA7+/4X3GBPSa0DAZheRWjHaFFJSfhyPbiqbg4kfmw18MF5K5ESENB2cXw CBl4holfgJAgl7dNMPrmZ85AUgafdxKOtVuHYZB94HKbykYusg4qlpGqFJqhpF073JAltgQ== X-Received: by 2002:a05:6830:1005:b0:6eb:d466:aaf5 with SMTP id a5-20020a056830100500b006ebd466aaf5mr2052444otp.0.1713540120745; Fri, 19 Apr 2024 08:22:00 -0700 (PDT) X-Received: by 2002:a05:6830:1005:b0:6eb:d466:aaf5 with SMTP id a5-20020a056830100500b006ebd466aaf5mr2052412otp.0.1713540120236; Fri, 19 Apr 2024 08:22:00 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id wk17-20020a05620a579100b0078f1c03f06csm497608qkn.113.2024.04.19.08.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:21:59 -0700 (PDT) Date: Fri, 19 Apr 2024 11:21:58 -0400 From: Peter Xu To: Mina Almasry Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Andrew Morton , Muchun Song , David Rientjes Subject: Re: [PATCH 3/3] mm/hugetlb: Assert hugetlb_lock in __hugetlb_cgroup_commit_charge Message-ID: References: <20240417211836.2742593-1-peterx@redhat.com> <20240417211836.2742593-4-peterx@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Apr 19, 2024 at 08:03:08AM -0700, Mina Almasry wrote: > On Wed, Apr 17, 2024 at 2:18 PM Peter Xu wrote: > > > > This is similar to __hugetlb_cgroup_uncharge_folio() where it relies on > > holding hugetlb_lock. Add the similar assertion like the other one, since > > it looks like such things may help some day. > > > > Signed-off-by: Peter Xu > > Reviewed-by: Mina Almasry Thanks. > > > --- > > mm/hugetlb_cgroup.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c > > index aa4486bd3904..e20339a346b9 100644 > > --- a/mm/hugetlb_cgroup.c > > +++ b/mm/hugetlb_cgroup.c > > @@ -308,7 +308,7 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, > > { > > if (hugetlb_cgroup_disabled() || !h_cg) > > return; > > - > > + lockdep_assert_held(&hugetlb_lock); > > Maybe also remove the comment on the top of the function: > > /* Should be called with hugetlb_lock held */ > > Now that the function asserts, the comment seems redundant, but up to you. IMHO there's no harm to be verbose in this case, so I'll just keep it simple to be as-is. Thanks, -- Peter Xu