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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 018A1C433EF for ; Wed, 13 Apr 2022 18:28:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 257416B0072; Wed, 13 Apr 2022 14:28:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 206836B0073; Wed, 13 Apr 2022 14:28:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07FBF6B0074; Wed, 13 Apr 2022 14:28:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id EC9C36B0072 for ; Wed, 13 Apr 2022 14:28:41 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AA65E258A5 for ; Wed, 13 Apr 2022 18:28:41 +0000 (UTC) X-FDA: 79352691642.07.AA04714 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 1637E40005 for ; Wed, 13 Apr 2022 18:28:40 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 93C96218A2; Wed, 13 Apr 2022 18:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649874519; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bovZqnW3J0sEXG7lYTUTR5FPz9PnssVKHBXSHW46LQ0=; b=PQonp1i35SxnZ2dbgKPu3HjVNiKFgwCjk0Yh/iC11NYQyLAqbnpig19Z+LdAFK4p+2jRda J1i8MRR7zXduEY3aLb9/L5inQLHGmK8oxFd4TOgNuYLCbAy0HEgouveF+1gnxE8d5zKREg oB4WQHUYTqAXFZj5wiLfQVkpcKZxCPM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649874519; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bovZqnW3J0sEXG7lYTUTR5FPz9PnssVKHBXSHW46LQ0=; b=bC5OHzIBPmRa6JH5hnumHiSVp/pd20Rk3/Qi2UIFsm29TVOpl3WO0cRiqVRpx5iZGa1ReW n/UZWOyvYCj7ISCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1F63713A91; Wed, 13 Apr 2022 18:28:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id fRF8BlcWV2IhdAAAMHmgww (envelope-from ); Wed, 13 Apr 2022 18:28:39 +0000 Message-ID: <5fc7d007-e59b-de8d-4d88-3f1b5adfa95b@suse.cz> Date: Wed, 13 Apr 2022 20:28:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v3 12/16] mm: remember exclusively mapped anonymous pages with PG_anon_exclusive Content-Language: en-US To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: Andrew Morton , Hugh Dickins , Linus Torvalds , David Rientjes , Shakeel Butt , John Hubbard , Jason Gunthorpe , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Matthew Wilcox , Jann Horn , Michal Hocko , Nadav Amit , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Liang Zhang , Pedro Gomes , Oded Gabbay , linux-mm@kvack.org References: <20220329160440.193848-1-david@redhat.com> <20220329160440.193848-13-david@redhat.com> <012e3889-563b-e7fc-c2e3-e7a6373a55ac@suse.cz> <2ae0a409-3d6d-9f6a-09e8-2f6867a4069a@redhat.com> From: Vlastimil Babka In-Reply-To: <2ae0a409-3d6d-9f6a-09e8-2f6867a4069a@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1637E40005 X-Stat-Signature: 5hqbh1y3aa79dun5uitjqk3h34e5wuhn X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=PQonp1i3; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=bC5OHzIB; dmarc=none; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-HE-Tag: 1649874520-71246 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 4/13/22 18:39, David Hildenbrand wrote: >>> @@ -3035,10 +3083,19 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, >>> >>> flush_cache_range(vma, address, address + HPAGE_PMD_SIZE); >>> pmdval = pmdp_invalidate(vma, address, pvmw->pmd); >>> + >>> + anon_exclusive = PageAnon(page) && PageAnonExclusive(page); >>> + if (anon_exclusive && page_try_share_anon_rmap(page)) { >>> + set_pmd_at(mm, address, pvmw->pmd, pmdval); >>> + return; >> >> I am admittedly not too familiar with this code, but looks like this means >> we fail to migrate the THP, right? But we don't seem to be telling the >> caller, which is try_to_migrate_one(), so it will continue and not terminate >> the walk and return false? > > Right, we're not returning "false". Returning "false" would be an > optimization to make rmap_walk_anon() fail faster. Ah right, that's what I missed, it's an optimization and we will realize elsewhere afterwards that the page has still mappings and we can't migrate... > But, after all, the THP is exclusive (-> single mapping), so > anon_vma_interval_tree_foreach() would most probably not have a lot work > to do either way I'd assume? > > In any case, once we return from try_to_migrate(), the page will still > be mapped. >