Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8821242ybl; Fri, 17 Jan 2020 01:34:43 -0800 (PST) X-Google-Smtp-Source: APXvYqw8Zk2DUwq0BAKyUbDXjigp2lWsAC7MhWPrLcBYzpS/p8qzmiKpGBUTx4HD2g2wSGqCwq+W X-Received: by 2002:aca:4c9:: with SMTP id 192mr2871091oie.105.1579253683420; Fri, 17 Jan 2020 01:34:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579253683; cv=none; d=google.com; s=arc-20160816; b=dWKxyXOkvOpIa0gPqAk1q/NyTKU6u27Kbuv/QOPAs/wCGhmtue25qH6iTIySYKIkkk SYOOqHKh54yhGhJdn7p5VY2nUfbIoBRqDGDwkbbfK4MoEb4QZDrXOCbgTsP/aJCaNOaf 40vHgNV0UVLV6gFZnH42J0lUozpG322Tn2c5pdXmZEoom+sdqsvY9QXR8B2pmqa0F1W1 SYh4okd1jd9GoPpzaqAcamPGJMUY+2c42t+jgg7J+2xTPnzE7NAINaSobCP0Zqjd52D6 W+S5lbvpfNa5c2106lNZy02g+OzDyfHy9qvVVPNlsz70MnL4fup65YguX49w3dVE/fSF v6yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=p0FYXrhY0dK2Yq0ADqbuALXVIqL3DOBXcQh5lESagqw=; b=s0Uyp6rqWZ5DeNjpt2QD2XkMmuXaboSMJBSqQovdJ9q8Pm0knPfvr/kA2HuoYXbU46 zBcky7/z3jYpQ5qSyudyVvf6cOLbONrWkmXQZA+ATujIdb0qn19N5cuj7L5kdPwR+3KH 3h9zYFV4bOvunuaQQ2hLRxNeM7jG8WHO70Pc720ooNr4+XzqeU0QqqjkgXebOQIQ3k7q F12YBfvu2/TwMlyvMMe0K25Ic2bGLsZNxY573/3bTq+2ZZQ/znPzbxCj6jqSiSyZFE5x CTqzxDWNj3Nhy7wxzl92wX0ItTvy1S3B1w+Fps6alWDoDUzlOm4ba1xLmTULi6SCbm/C FiqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TF9fXgaU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si14484894otl.29.2020.01.17.01.34.31; Fri, 17 Jan 2020 01:34:43 -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=@google.com header.s=20161025 header.b=TF9fXgaU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbgAQJdK (ORCPT + 99 others); Fri, 17 Jan 2020 04:33:10 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:51889 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726898AbgAQJdA (ORCPT ); Fri, 17 Jan 2020 04:33:00 -0500 Received: by mail-pj1-f65.google.com with SMTP id d15so2907770pjw.1 for ; Fri, 17 Jan 2020 01:33:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=p0FYXrhY0dK2Yq0ADqbuALXVIqL3DOBXcQh5lESagqw=; b=TF9fXgaUP4k4EAUC/Dy/SrOzwDt7ThZAFl1RiO2a29ruRoatv9IVB/khL4saK8kRVr jmQulM0N9UWJo1tVbMtZSwfUOSeBO82sunl63tNxOn9BFdV+BcFNIApGC+7vEbF5JCs/ sFX4nSxwdD66o0jnSZQb+cuxIhTNSgQPJw+NbD6Yp2tQePUHbGgagbNBt9loJ1etUD8y ju0tJkK2IpWUyY0tP+T6wcrO6lkabPJHh0jysu0L3AYYtHptfY8IDpWqeHAFxNNvJ2PP 2UZyeAiwnjYi/RrtKRf8YgfE3/Mwr3ec4ZhjQSrEwi+CGDiEwax83iA9qESUsmFSl9lm BKcw== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=p0FYXrhY0dK2Yq0ADqbuALXVIqL3DOBXcQh5lESagqw=; b=VKNI3GS0LmtFfnygaL/AowUjdiD4T1qmggnEOvJxFrnKOlIGtl5fL15MGuJeW8a6vt ifl9Dg4iC5RGe6PwKJLD+kv074yFMkSFisLM3h1L3gW3k8QLeiIGsc48BDVjg3k7Yl+T J1aqPi/CG2jSaoxI4QlVXKsw1gR+oNaqgzfOetJfpGiUjCHeP3wE0wO7NL+YnQPBfiE5 LLRbV5zd/ZsH0Ef2L3HGwsuVL27s2/lcEUP1+XIKTB8/d1x9SwvLKUQ7KbVTxCrMYUl6 De6nhXFeQSbwktXgB5JuH7jRloZidqUud24f9tXeUdi7nnpsOL0XQtckYPUqrg2h0va7 ersQ== X-Gm-Message-State: APjAAAVnpOo/IRV1f1uWH8+iJLNe1TVY4atjroZUfBCkB6Nf6g3MbJON 7HfHuchJxBdmk6r5cWtqfpDnbw== X-Received: by 2002:a17:902:59cd:: with SMTP id d13mr43612993plj.146.1579253579655; Fri, 17 Jan 2020 01:32:59 -0800 (PST) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id c22sm28137098pfo.50.2020.01.17.01.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 01:32:59 -0800 (PST) Date: Fri, 17 Jan 2020 01:32:58 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Kirill Tkhai cc: Michal Hocko , Wei Yang , hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, 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 In-Reply-To: Message-ID: References: <20200116013100.7679-1-richardw.yang@linux.intel.com> <0bb34c4a-97c7-0b3c-cf43-8af6cf9c4396@virtuozzo.com> <20200117091002.GM19428@dhcp22.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?