Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1134398ybx; Thu, 7 Nov 2019 07:46:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzAU+/WRuwY9p7bEdToKU6ruujHcmsUX+9ZLS9WVNzx4pULgCsOoqxBCGgzfNUUo7Tpe+nf X-Received: by 2002:a50:ff12:: with SMTP id a18mr4239955edu.200.1573141588640; Thu, 07 Nov 2019 07:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573141588; cv=none; d=google.com; s=arc-20160816; b=VZ71UWsy1uoqrEWDce8WEa8yF+Hla6U/bNHlWzjMLpyCNp9ZOoK1Uovho407o3LffU 3HE8yQoLerQre4GBlccwKaU5/Hq/+FWfqq/zrlDawtxVBy2r2a5C89+Y+h2+fCLS6AAq KxU13xIo2EcQtjdlW7LT0UxYt0NikpZNsjfRjeE9hzM6zcSNwhKM0w5VGYc7R9UpM62c YH8IOAKnyKKx3DNvvVbCrL51B9+LFrse+C86X0qJYZKlTtrPuQAXS/x0ZvgxyY4qJhhz 7y7yWPf7+/pRppOi0zxx9gdnys1xKEmu3UDgj1CuYmeb8vkOq54piVJOnp96VCGW8Yfk zlFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/VLsWSGCw7M78G2ciEeMt8ki0nUc+nWXcIjdygNoX4M=; b=IJR/O7bQ6U2kQcIo6KmUeJcBEu1kkLrvgnBuXGa1VHl3jMXhR7iGUGWKfRv1rFhvjf TulUtyb/hLy4xtNMhA9WB9ZVtmLVbtiRD3Z9lpWRaO9PI82P7Kknm8wnnVqtDQXJocRY lQT5FQq0OHuqpW9Ci/pEXshF2wcOyoDU9TmcftroJTObmJN3tQfDlcUmxMuAhOpkVz7a C9nAUS7Y1R8769iofNCPG9iZ1iSUSpJGIPFZhFUyhmcQdu4nV65yF6skzKLHLNSlPaIj 05X2JCmsqGVYY9K9m4n55Uxq+U+ZSh4fI1SMc5RQMTUF9VG1gge27jwdwRVE5T0uVrAt zeuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=POhLYOxu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x18si1541138ejo.78.2019.11.07.07.46.04; Thu, 07 Nov 2019 07:46:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=POhLYOxu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389213AbfKGPoR (ORCPT + 99 others); Thu, 7 Nov 2019 10:44:17 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39777 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388901AbfKGPoQ (ORCPT ); Thu, 7 Nov 2019 10:44:16 -0500 Received: by mail-qk1-f195.google.com with SMTP id 15so2365387qkh.6; Thu, 07 Nov 2019 07:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/VLsWSGCw7M78G2ciEeMt8ki0nUc+nWXcIjdygNoX4M=; b=POhLYOxufAI7xHlzUJDemniGTcznmIvhHjolHRByJVTX3xroAktxe3C1Liz/KxCXZ6 6VaC61mFQW0hAuUJlPxrGVCEzcw2PkEKtvRl/1fnuD/Ag6A7t5p/cwE6gBWJptUI60Vk e7V9SH8Fe3pHCGnaPrPWX7HMYocKHMr/nJa2UcRmmpYynv24nKSwcNzkqdvw5fc3xFTW 5DPNQz2AZIX8ZEgYZhdcp2jrSvcUALboEuXkf5JBt1iEZtM7OLE1rgbj767PvQ1fMnAO ROaVcKgdglj5gXWKGQh0RjoC5feo/Iv3LeIPq0C2wwP1PXRpKv+wFE0bxrGEw5cPehHw DYnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=/VLsWSGCw7M78G2ciEeMt8ki0nUc+nWXcIjdygNoX4M=; b=cGqQ+AfKJkoldgyFi/dws2KebqKLznAuRiJnhaUcw9ulXOtuoj4bnJfpjLpOk2Gs4W qLwE9L5UUMPR6K5MkKMtSOgApEcPS/W2Ro+veqUfsN7Iw1+lgV8c3cfMQc/J/72Ygzzw ISVKACDaFm5yaXUhzInNlR3M+anQcODB7XkRmi/c8MSS10+nDXAvsX4z1QkG/KmSzhRf FfZvM7POECNyWRe0nm9EzVtO5PwdQvJOrKymKH0hu4WSOdrRLp727L8UEcLlLmrfFoEN CBQ2VrOw7CFKD6ylW78kNXkdgMAcZZWuWtlC8jZIoY5ScgdLVfjuabBCDh3X+H8j2lW9 hoCQ== X-Gm-Message-State: APjAAAVme72tYQPZ5PQYuy7m1U3BC0tbOiRcky4RG/UJ2I8SwCBWuUL+ IS7/quzfU/jnIA/4N0siZvw= X-Received: by 2002:a37:a950:: with SMTP id s77mr3448271qke.463.1573141454976; Thu, 07 Nov 2019 07:44:14 -0800 (PST) Received: from localhost ([2620:10d:c091:500::2:3f13]) by smtp.gmail.com with ESMTPSA id 19sm1330971qkg.89.2019.11.07.07.44.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2019 07:44:14 -0800 (PST) Date: Thu, 7 Nov 2019 07:44:13 -0800 From: Tejun Heo To: Roman Gushchin Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , Johannes Weiner , linux-kernel@vger.kernel.org, kernel-team@fb.com, stable@vger.kernel.org Subject: Re: [PATCH 2/2] mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup() Message-ID: <20191107154413.GZ3622521@devbig004.ftw2.facebook.com> References: <20191106225131.3543616-1-guro@fb.com> <20191106225131.3543616-2-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191106225131.3543616-2-guro@fb.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 06, 2019 at 02:51:31PM -0800, Roman Gushchin wrote: > An exiting task might belong to an offline cgroup. In this case > an attempt to grab a cgroup reference from the task can end up > with an infinite loop in hugetlb_cgroup_charge_cgroup(), because > neither the cgroup will become online, neither the task will > be migrated to a live cgroup. > > Fix this by switching over to css_tryget(). As css_tryget_online() > can't guarantee that the cgroup won't go offline, in most cases > the check doesn't make sense. In this particular case users of > hugetlb_cgroup_charge_cgroup() are not affected by this change. > > A similar problem is described by commit 18fa84a2db0e ("cgroup: Use > css_tryget() instead of css_tryget_online() in task_get_css()"). > > Signed-off-by: Roman Gushchin > Cc: stable@vger.kernel.org > Cc: Tejun Heo Acked-by: Tejun Heo Thanks. -- tejun