Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp248539ybx; Wed, 6 Nov 2019 16:28:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyXyWt5WYq5ZFEoC/TZs7u/XxorQM5zPqLO69EoznmFJGsdgSKWZd90PaP8JZ78s3x/tBFa X-Received: by 2002:a50:898a:: with SMTP id g10mr576996edg.191.1573086483815; Wed, 06 Nov 2019 16:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573086483; cv=none; d=google.com; s=arc-20160816; b=G77zaDM3RXvjTgJqiuZQin3bV6Enkp+9Txic6cg5bnyMe89Oa/bwHfFs3uUuyc9ZuJ W6KFENhBGbbscM/sg82N0Cr9Q56KphegFYR91Dds5UHceA1I2NjnNwyHEl0g8KxJYCNm 2FW9fAUiVkM3F1J+isg8lE9+F904aQQVaXOA9Bd9aARxUSe0HEwkUqLSZd3M4MWroqnA iE02VPHGPh6gGUS2DvaOnRo4gmZSOHuqcgUNAfbTGxjxRsupOHh3XbWS9VPPLUMIEVj0 Tuia3Ed3Nc5ujL5TCUijquB5o072vetTDH7UCMjRMAcw7gAG1L/7Uh/rugFwwSeBf0j/ l6eg== 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=KEOopLJ5iB8RmpEZTW4jEm10x8g53h0m9wq9YjVBDLY=; b=0rdSGai0lodm16EuWI5XrN/2OTBlgR8ygEbwx9vDe2BC70PsuQjcqCiVyHF7cFX5w+ 7j2X+cb9mHT/UYm8oIFhsDwcSBspFs2XUyo4Q+PsRlbqC0+W+65uFgpu5NlHLTNAEeug FFca+fAF47vKv/vLv9/i4ECwC33HKaPjVwK5Pm0/NDNFdOSXRKsmO2//0e9i3sVUWEHG /QI0UKM7Z5g7Qbcv/+yi8XqDJUheLXVVsYwo1Oy6OrzpnUeG1UGZtB4zrsffYeO4fp5K YAFfddUv+pWQ+i0fD6zbcf3eQ6GOSovbSq23QEXZX9bW0T3waHf7ecGF7y/4R1X36Ea+ vlXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=lFJWdmZX; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si332977ejc.17.2019.11.06.16.27.40; Wed, 06 Nov 2019 16:28:03 -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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=lFJWdmZX; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727994AbfKGA0r (ORCPT + 99 others); Wed, 6 Nov 2019 19:26:47 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39258 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbfKGA0q (ORCPT ); Wed, 6 Nov 2019 19:26:46 -0500 Received: by mail-pl1-f195.google.com with SMTP id o9so110796plk.6 for ; Wed, 06 Nov 2019 16:26:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KEOopLJ5iB8RmpEZTW4jEm10x8g53h0m9wq9YjVBDLY=; b=lFJWdmZXI9+2+oMrIJP43CTG56fV3KIfPp/Qh8xHL8cg35kS1x4Dp/SxrZkjsSECvk KJmBS+bONNbKXnrVc6mASGrPB7I+usQ0ttu+yCrsvvJF+Zc/64T9RuJWm4e4HJQ3LQI0 S0ClECVzkELJiWf/U675WfVrtD4a4MaUM3tKXceQuKbqOxVAcPEKLaIjojA8q7RyvF9x TgjKMAtx+UWfzcbO+ICuL/CXdUpPbrjlktWidyLEk6HT/XVA6R/m+Te9n4lSFOybVZMy u0Yx8eJBr2sz/L5GfPpGaXnsb0G1tcE0FLjYAo8nEzCYzF0FN9eqicVMSY6W4Jl91EQ3 0R1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KEOopLJ5iB8RmpEZTW4jEm10x8g53h0m9wq9YjVBDLY=; b=Y2lEQMs9w1kaOEiBbziofZMC8XxmeOQAvmUgqTpRWrtOgN3Uu2kQw1rpJJ/Fy66DH8 5N5EleCdyq2Xim+qSsNdaI6KMFxUds7AZQ+U4r6UuEhkdbtjNunRjB2MJy20qdB5D5h3 2JOleiK5Gw0wPgqZ+PTMsb0aPJA1eECR+WWbweH473O9XRjBY0ND+dkpCQd7XKpNunzb UhCNmmSTjuSfr+l2pnxPsEf4Mrr6GIbGdI8wsJneip61t/zN+PZIsosvHn2jHW2dHsle mqh7SKTeHdDs0jhHt6CxxI8TxyCrk7ijnt9VLax8erflB03qECYeA1H8HnnorLeGZfa8 zQ7A== X-Gm-Message-State: APjAAAVEtGpE3OjoMWahVtfqD0jsVYJM3/FGdQRsVygoOnXPOEeCX7sP vpcj20nqu++2MIze/jvYO2yajw== X-Received: by 2002:a17:902:7d90:: with SMTP id a16mr481361plm.149.1573086406181; Wed, 06 Nov 2019 16:26:46 -0800 (PST) Received: from localhost ([2620:10d:c090:200::2:deb0]) by smtp.gmail.com with ESMTPSA id l3sm169756pff.9.2019.11.06.16.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 16:26:45 -0800 (PST) Date: Wed, 6 Nov 2019 16:26:44 -0800 From: Johannes Weiner To: Roman Gushchin Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , linux-kernel@vger.kernel.org, kernel-team@fb.com, stable@vger.kernel.org, Tejun Heo Subject: Re: [PATCH 2/2] mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup() Message-ID: <20191107002644.GB96548@cmpxchg.org> 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.12.2 (2019-09-21) 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 Acked-by: Johannes Weiner