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=-9.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL 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 22684C33CB1 for ; Fri, 17 Jan 2020 09:33:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D85DF20748 for ; Fri, 17 Jan 2020 09:33:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TF9fXgaU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D85DF20748 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 74F6D6B033F; Fri, 17 Jan 2020 04:33:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 700006B0340; Fri, 17 Jan 2020 04:33:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 615086B0341; Fri, 17 Jan 2020 04:33:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0004.hostedemail.com [216.40.44.4]) by kanga.kvack.org (Postfix) with ESMTP id 4AC256B033F for ; Fri, 17 Jan 2020 04:33:02 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id DA08E8248076 for ; Fri, 17 Jan 2020 09:33:01 +0000 (UTC) X-FDA: 76386612162.04.dad02_549490b045d00 X-HE-Tag: dad02_549490b045d00 X-Filterd-Recvd-Size: 4901 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Jan 2020 09:33:01 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id g6so9639556plp.6 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=kNnD3/fhcae2zNeAAIHzsbzjMHv+IyJ/jEa5Kf0vDWrac4rtmjfDa1aivMuMXbLDYv 0W9MzABIm531aZVZRW0ZrO09dFpBCBdAVdEpraL89HZAqE/3PmC4x27KnEoJ9v+gpaEB PVyv57vZWVAQJ4dDd1EIJq6YY0odOGoIKjvhsEcDlASIzk1iyVzjK7lJOsxsp/XrRw9C S4TOEG0ztEr1Br1Mpv1eV4F3ftN826wgsZxIIXidMagxIxn/qM9KumRY/PBUIAXSU2ZQ iUgQ3A06J3oKTC69fJ8z4qIZ3lNHVySD6AfIu7di8MD96YPYgCACu3zmlTIZnmnm9Q05 Z8Mg== X-Gm-Message-State: APjAAAXdyKQBZ4rOEZNcmR1/htOucehsiJDRrh9Qs0Mw9/dHAbSO88np 3NhA6GP3iW82dGQ4HK7LRNy3Bg== X-Google-Smtp-Source: APXvYqwrLEAFB5O9bxsGKIHjogYbkqKBu7pjTnCF9v/vgbb7R8TIhtoQCKwAw/QYjhF/m1x+onqgAg== 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 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 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?