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.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 6C270FC6197 for ; Thu, 7 Nov 2019 00:26:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 25265206DF for ; Thu, 7 Nov 2019 00:26:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="lFJWdmZX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25265206DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CDED96B0003; Wed, 6 Nov 2019 19:26:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C8FC96B0006; Wed, 6 Nov 2019 19:26:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA60C6B0007; Wed, 6 Nov 2019 19:26:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id A19A96B0003 for ; Wed, 6 Nov 2019 19:26:48 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 1BB6E282C for ; Thu, 7 Nov 2019 00:26:48 +0000 (UTC) X-FDA: 76127590896.16.chain10_3b4d406c38e62 X-HE-Tag: chain10_3b4d406c38e62 X-Filterd-Recvd-Size: 4021 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Nov 2019 00:26:47 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id d29so102116plj.8 for ; Wed, 06 Nov 2019 16:26:47 -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=V7ldHeHZeTqvMJPslJUbMQOG+4G/CyK29/qcgBU4Bi8Gx+o24F192iAtXIPIZAFDzw eVWHlFlpBJbsfYD+uuB5G3d5fG4TyMV9rCb0n1fDOpO38sh73gkL94tDm+Teng/SpoF5 raXet6OHSVhG02nM82rFxShhgClVa/giT1exFxGyZKo5SzY7XWt8N2lTqoiK/EySBbWb A6urW6mw2vtgju4jM6WdPj8OXy6KiLLx4HlaotMdPLPplbnam0QjtuVR3HebowrCuViA V31IlQFkNiJL8pkebz7rOFUZWftxr1Jq8yHHSlqQw2esbNRsKi3fr10Fn3uSYuTdOncD Ga8A== X-Gm-Message-State: APjAAAX9dMBeac96V8hNhH/tO+tifbvPRdiOpyMq0pCIE0l7UuQ7Qf+H icfZ7rLX1R53O3Mk6+ZT5B5g8A== X-Google-Smtp-Source: APXvYqzNhi4Z4rqSd1SYZHPd68UCauRrDczwT9rsRKj8pjv7pVf3AFuzhiJThxTX5L2Fg9OfLaicyA== 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) 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 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