From patchwork Wed Apr 17 21:18:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13633852 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D16BC001CC for ; Wed, 17 Apr 2024 21:18:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F284B6B0099; Wed, 17 Apr 2024 17:18:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EAC996B009A; Wed, 17 Apr 2024 17:18:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C61F66B009B; Wed, 17 Apr 2024 17:18:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A2F846B0099 for ; Wed, 17 Apr 2024 17:18:47 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4A37540FAB for ; Wed, 17 Apr 2024 21:18:47 +0000 (UTC) X-FDA: 82020288294.22.9122F60 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 1DA3D16000E for ; Wed, 17 Apr 2024 21:18:44 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AjoxlII1; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713388725; h=from:from:sender: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:dkim-signature; bh=RODytP55S9PjZjf+7gfJJ4x6mavqXkgxb7Ks2uWHAe4=; b=1l7RTzyWvxvFje5Dl7+J/Lvc2nfa49yfePk+1HhRQslj3DcAdPuMwHCN9dnGS0toBlI4Nv 8ZXMBRGXbKvhHMWSAzlk2eGRiSA42bL5S0RvLqS9bn0KPABudS6YQJqJ41edvJRKaGPdmZ iCt5GtG0+KsCjfUCYMV3FVWUgZIl2Eo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713388725; a=rsa-sha256; cv=none; b=IOOweMX1v44i/qy6qfFTp4JwF/78enXPxvA/TlJW3CfJvyU6fYoStsR91R2x0jaclJQBtS gfI7WvguScUWto/QuMvjlOoSY4pUEdSCIjIhSq64SV5BORDUEiMgN+Vn3+OXBOiuOpHFe9 tFwam89pLZ5unM8t6xZVg/Nx/RMV/8c= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AjoxlII1; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713388724; 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=RODytP55S9PjZjf+7gfJJ4x6mavqXkgxb7Ks2uWHAe4=; b=AjoxlII1AiOMLIGuUdtQP5Q2nw1o+clfyE3/a8ydNTQoBhTu9CMjyqXRhYnaDOGpV5Pu02 RhEvmaklJXAvWPU9MQs/5174P8bwNbJg0fMipjoYXB7RF6P+zO1VFuijHo4yJ1bqs2qo6v vi5BYhN20qYfTGvY+xi1yME8KB14Wc8= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-nxpRz_rdPCyJ3s2_f_pKZA-1; Wed, 17 Apr 2024 17:18:43 -0400 X-MC-Unique: nxpRz_rdPCyJ3s2_f_pKZA-1 Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-6eba7dc8f1dso26814a34.2 for ; Wed, 17 Apr 2024 14:18:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713388722; x=1713993522; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RODytP55S9PjZjf+7gfJJ4x6mavqXkgxb7Ks2uWHAe4=; b=FPA9MMxfz8/BwiqZZJvEXAEEhbyH8hQVGIJxlQKvIWF7CSghsCp2U43T/jSpXvmd+W UM/vjIDdHV/6tN2L5HwmIIVgKyU7TGPLVE3QmcCOx2f1KarDg9CFU4oAz6qFjepDBhwn F65s2KRn+D459iP9j+X+0IgGTVONWDOm/UHK+e3ooRYhf3C1fpVhnOH50+/3Vm+56/lq QLgtJpf+68nEjuSQkvwpvFwGkLWoRyISNwFTfSTKuJR5LgjMdcvSAdHNJMMdXh33iJ2f czAlgB7utXfLqIqoD35lSbD12XGdcW076wGnuqV8nd/pRs9gjWkYXrBAKi6XaDMv9wYb NVAQ== X-Gm-Message-State: AOJu0Yy74Il0pXhG2PsPBGAKJT4+DdoE0ZQbj/nFq2deIjqMcTt6fvCL VqTX9reiFUeFU0L9P1CKasQuEkLsz5WWGAcVCmYb8SdRJY2j2vc+SPdZeBK0xbIL4pQ+QHYcKJM YY3JzUSKOPTRVyeJmAdY95WgQZey3F6cVBEawGCDCISU7g9QaHJt9Cwry70OfXUdr3PUvWS9+zd XtA2Qt/tKAEcn+12JeZmlSxYjX0Ja2pQ== X-Received: by 2002:a9d:7406:0:b0:6eb:7e33:3fbb with SMTP id n6-20020a9d7406000000b006eb7e333fbbmr838913otk.0.1713388722177; Wed, 17 Apr 2024 14:18:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGQuu+Ru3d/WAMoyXikWuaGubuV6xaXPDqyX9q9vBRfpwd+WdeOnRC1LPB2iMpjdigzkGg1g== X-Received: by 2002:a9d:7406:0:b0:6eb:7e33:3fbb with SMTP id n6-20020a9d7406000000b006eb7e333fbbmr838884otk.0.1713388721661; Wed, 17 Apr 2024 14:18:41 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id c10-20020a37e10a000000b0078d667d1085sm18692qkm.84.2024.04.17.14.18.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 14:18:41 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: peterx@redhat.com, David Hildenbrand , Mina Almasry , Andrew Morton , Muchun Song , David Rientjes Subject: [PATCH 3/3] mm/hugetlb: Assert hugetlb_lock in __hugetlb_cgroup_commit_charge Date: Wed, 17 Apr 2024 17:18:36 -0400 Message-ID: <20240417211836.2742593-4-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240417211836.2742593-1-peterx@redhat.com> References: <20240417211836.2742593-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1DA3D16000E X-Rspam-User: X-Stat-Signature: a6g7i9p1ymjkwugghjx19hy6wpkpx6qg X-HE-Tag: 1713388724-8863 X-HE-Meta: U2FsdGVkX18Lt69nAMy3R7QUC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wZHsYf0xMZve0PwuZz2QZVpWzJiseFUSXk+kMjYv79n7zUysm6bU1LvF9xBNVaY6sp8crsnPMPYxVhNgh713J9h+Jo1Es/LFg08dF68/KL7g/JE1owgpYhQiQxL6csYuIWFtgJPAQJ9P2DVZTtYjQJt/GMFr+zmFTou7kGNmma03ChgLZQUOaP6LH/Q6ciXKYId1UrSKXGxhgxY7o+hSNz4nZwIrZOMEcZSJgLYCjQOoi952zi6EcPlNnp154raK4R1mcNurh8H60FJmsSx4Wqs96Nx5QZx2c87BI87KtvXwTw7OaKtP7QFFj1s8rqA9GN6MmMFjbjSg== 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: List-Subscribe: List-Unsubscribe: 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 --- 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); __set_hugetlb_cgroup(folio, h_cg, rsvd); if (!rsvd) { unsigned long usage =