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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 44FA4C33CB1 for ; Fri, 17 Jan 2020 11:59:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A2CA20730 for ; Fri, 17 Jan 2020 11:59:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A2CA20730 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 88DBA6B0363; Fri, 17 Jan 2020 06:59:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 83E966B0364; Fri, 17 Jan 2020 06:59:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72DF56B0366; Fri, 17 Jan 2020 06:59:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 59CCC6B0363 for ; Fri, 17 Jan 2020 06:59:39 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 13DB2180AD817 for ; Fri, 17 Jan 2020 11:59:39 +0000 (UTC) X-FDA: 76386981678.06.honey64_37160a2f56339 X-HE-Tag: honey64_37160a2f56339 X-Filterd-Recvd-Size: 4723 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jan 2020 11:59:38 +0000 (UTC) Received: by mail-wm1-f52.google.com with SMTP id q9so7156619wmj.5 for ; Fri, 17 Jan 2020 03:59:38 -0800 (PST) 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=udlU6SpvxzvjKHENifeUg1Az8MLTSzxnXtnR1+RwbnI=; b=Jwrd5Q0hHXvrLYxH6Hd/RktOKwyRuDAwyykhwo/Es3MkxgclDCdnYd1j+brI/bjQFm KkVUMb1U9UJOEwQ+jP0JDWJRxrc7UKeBsFPV1q9LHQxF7q4oqIvFsBAocIc/AmcV20aO LWVkZ+GObHBJ7ZnQcEN95OsVRy/XFga8bNDAYCgbJXwASAaSnsv1lVLIiFilPaQQX8LN HjwOIRITQkcl5g+4/ep6gRDj9fYH/uKYDd/tmBktSYbnHnbuurAdWgNiYVESryk/KJ1Z 2sF8iotTsUB1gVv5YcgyzhqVgoJWVZsyE0Woe+2Cs0lNq/cEYE+IAmm18kffrGXxV+F5 Lj5g== X-Gm-Message-State: APjAAAXSdu+06E4hycDrBl9Pl/pGSE78bT2PLabkT1T4YFbRHCGwFwGe Ws0wMuncdXS/Fi2opq0b8+U= X-Google-Smtp-Source: APXvYqwN5WxNfeK4SlgaL8V1bxIdZmgc9Q8OC8cG1RNh4NYAGxptEVaBGdfHAAy+NA3Rdh0s+BxZiA== X-Received: by 2002:a1c:1d1:: with SMTP id 200mr4248107wmb.181.1579262377136; Fri, 17 Jan 2020 03:59:37 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id o129sm9364730wmb.1.2020.01.17.03.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 03:59:36 -0800 (PST) Date: Fri, 17 Jan 2020 12:59:35 +0100 From: Michal Hocko To: Kirill Tkhai , g@suse.cz, kirill.shutemov@linux.intel.com Cc: David Rientjes , Wei Yang , hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.or, yang.shi@linux.alibaba.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexander.duyck@gmail.com, stable@vger.kernel.org Subject: Re: [Patch v3] mm: thp: grab the lock before manipulation defer list Message-ID: <20200117115935.GW19428@dhcp22.suse.cz> References: <20200116013100.7679-1-richardw.yang@linux.intel.com> <0bb34c4a-97c7-0b3c-cf43-8af6cf9c4396@virtuozzo.com> <20200117091002.GM19428@dhcp22.suse.cz> <11ba0af7-c2b2-83f9-ac55-7793cedb8028@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11ba0af7-c2b2-83f9-ac55-7793cedb8028@virtuozzo.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 Fri 17-01-20 12:42:05, Kirill Tkhai wrote: > On 17.01.2020 12:32, David Rientjes wrote: > > On Fri, 17 Jan 2020, Kirill Tkhai wrote: > > > >>>> I think that's a good point, especially considering that the current code > >>>> appears to unconditionally place any compound page on the deferred split > >>>> queue of the destination memcg. The correct list that it should appear > >>>> on, I believe, depends on whether the pmd has been split for the process > >>>> being moved: note the MC_TARGET_PAGE caveat in > >>>> mem_cgroup_move_charge_pte_range() that does not move the charge for > >>>> compound pages with split pmds. So when mem_cgroup_move_account() is > >>>> called with compound == true, we're moving the charge of the entire > >>>> compound page: why would it appear on that memcg's deferred split queue? > >>> > >>> I believe Kirill asked how do we know that the page should be actually > >>> added to the deferred list just from the list_empty check. In other > >>> words what if the page hasn't been split at all? > >> > >> Yes, I'm talking about this. Function mem_cgroup_move_account() adds every > >> huge page to the deferred list, while we need to do that only for pages, > >> which are queued for splitting... > >> > > > > Yup, and that appears broken before Wei's patch. Since we only migrate > > charges of entire compound pages (we have a mapping pmd, the underlying > > page cannot be split), it should not appear on the deferred split queue > > for any memcg, right? > > Hm. Can't a huge page be mapped in two tasks: It can but it will get charged to only of the initially. I haven't checked the THP code in that aspect but from what I remember subpages shouldn't refer to different memcgs. Kirill Shutemov? -- Michal Hocko SUSE Labs