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 5AC36C004D4 for ; Thu, 19 Jan 2023 22:23:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D82346B0073; Thu, 19 Jan 2023 17:23:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D32A06B0074; Thu, 19 Jan 2023 17:23:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF9A96B0075; Thu, 19 Jan 2023 17:23:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B0F6C6B0073 for ; Thu, 19 Jan 2023 17:23:15 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7841B1A0695 for ; Thu, 19 Jan 2023 22:23:15 +0000 (UTC) X-FDA: 80372975550.25.7270437 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 5650E1C000E for ; Thu, 19 Jan 2023 22:23:13 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cE6n9OyL; spf=pass (imf18.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674166993; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KxWTZPauMXnpTaH3mq+4KakgefY9/3sGM9X+qHRltHo=; b=Jf6D5q5wxr+U6h/N4WP8leohWj5kB+JpkIXk0t2lV+b/Xef8XtXl1Q11zlfMgmk6pUWL57 O/2UR+CNo79fNIFI/dA3wN5/NdiijqjbUn8FiadG1MaXK5XeZxMhgSMxhzivJlZFq47Q2M k39Pvs5jYDCSg8VUO3BwRR/F376eY0c= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cE6n9OyL; spf=pass (imf18.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674166993; a=rsa-sha256; cv=none; b=RjlqxsKsktQbgvSHJo2kI3XcrcdOLyyTaRJM9gZOZZv9J1cavAJL38Q0Bw2JuDViKEwx1X N4wiq0OcAchWSQI/XUYKaNYr0ZGx6qYcuO3EcKMWFOeHizFoaMD5UWoJJm0nneMwSn85hL j1j0tEoyx3XY7qrIn+EnAS068o5/fgI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674166992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KxWTZPauMXnpTaH3mq+4KakgefY9/3sGM9X+qHRltHo=; b=cE6n9OyLpqfE9yKihEQ57z9kZW1OS2M+J70KMRiHtZ0tvltVJxUZ9G8aRf7zcdJmvZhfRs 5aCcBhFVzHIaAAZmzb8LgZMeUikcSCMGPkd8U21+/cskGc6JtSbvHnoubDofYq+hIWVjTa YrlnSoXDVjuWByxtrsaLntAu6BmMWVY= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-57-rBWKoYT-NO6aG3wwK7genQ-1; Thu, 19 Jan 2023 17:23:09 -0500 X-MC-Unique: rBWKoYT-NO6aG3wwK7genQ-1 Received: by mail-qt1-f200.google.com with SMTP id r24-20020ac85e98000000b003b68b691996so1609210qtx.13 for ; Thu, 19 Jan 2023 14:23:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KxWTZPauMXnpTaH3mq+4KakgefY9/3sGM9X+qHRltHo=; b=Ca8cnuab3sCLeqcSuoqtruTigTJfHX6YOn88wQqKpu7TRUruFH7ctyM2FOe/WOkj2Y 6Wi29TosozwSeYRakW0aY9FeAkMF6LjL3rs88Zy6TC3APVz88WvYmQRYe2zr2mcboXCq d9fD8lI2Ci6plOv/mPxgENGr78Psu+tMH0+R6XmlDdpdXxOswAW8mAl1RXG1nGLYUSGd +k4Gnam2udfUQoo1rEfqJhm2uKqmHkTsfRoytbshBNO0NSscoZo7LkHEP93t4tDyjNB0 OtQy0AlOTZUiZF2nzNH4ofFj16+vi+jyUikOs2BxpeQpmde41X/MZ1xcUB7PyeV9AF+r qGEQ== X-Gm-Message-State: AFqh2kriOXcpor/u4ncY7nKbsUNmI4P7U12yHnyKRRpcdG86qpgAe4EA opfHyF0R27R0soaYj/8BnJGrzxHkL0EeFSXRon2Phs+rKlPQk89zegl4IFE4hx13bb04hh+Q5Fx Jgaj+jW0AxKU= X-Received: by 2002:a05:6214:15d0:b0:519:ff36:a873 with SMTP id p16-20020a05621415d000b00519ff36a873mr19530718qvz.41.1674166988553; Thu, 19 Jan 2023 14:23:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXs1AilgOcAVjjfASECLApaVO/xdOmtsX1eluQMpvPfGGDkVwpLpBddnCkQ10P5KIXePFNEYTA== X-Received: by 2002:a05:6214:15d0:b0:519:ff36:a873 with SMTP id p16-20020a05621415d000b00519ff36a873mr19530695qvz.41.1674166988300; Thu, 19 Jan 2023 14:23:08 -0800 (PST) Received: from x1n (bras-base-aurron9127w-grc-56-70-30-145-63.dsl.bell.ca. [70.30.145.63]) by smtp.gmail.com with ESMTPSA id dt41-20020a05620a47a900b00705e7daf6f0sm9684773qkb.129.2023.01.19.14.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 14:23:07 -0800 (PST) Date: Thu, 19 Jan 2023 17:23:06 -0500 From: Peter Xu To: Mike Kravetz Cc: James Houghton , David Hildenbrand , Muchun Song , David Rientjes , Axel Rasmussen , Mina Almasry , Zach O'Keefe , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 21/46] hugetlb: use struct hugetlb_pte for walk_hugetlb_range Message-ID: References: <06423461-c543-56fe-cc63-cabda6871104@redhat.com> <6548b3b3-30c9-8f64-7d28-8a434e0a0b80@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5650E1C000E X-Stat-Signature: n6psn5cabp6ew1xofcu6np3wredbpwad X-HE-Tag: 1674166993-921779 X-HE-Meta: U2FsdGVkX19zJtQzgFsBOMZYrvNKQpxPUyRKmSnLB4+3Jh20M751x7XbPDnhIG46L+oaZ4jAI0UNfozA/vWod5Lsj15Vaffr4823aH0CYQVSTwu3CwXw0kP27gmCI0HaBNOhVAALavjnkN5cuT8U7W3sfyz4VH8g+LkN19dJQGtPTH4x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I+7Zb1RK+x2W7a0DQOjzsE4EP5v3qReHgO0w0BKcsa3bG35GC3hGT1lR9UGLSwRP90+r+Wu7MTSRbpZYZi/gzajNqDLSuN966/4WaK/zkdKBHdNxBWIgokVwlulczIjLQGNzjM21kTSXh5AjhDaQyPut3atq9FDRo5yNeFAvw= 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 Thu, Jan 19, 2023 at 02:00:32PM -0800, Mike Kravetz wrote: > I do not know much about the (primary) live migration use case. My > guess is that page table lock contention may be an issue? In this use > case, HGM is only enabled for the duration the live migration operation, > then a MADV_COLLAPSE is performed. If contention is likely to be an > issue during this time, then yes we would need to pass around with > something like hugetlb_pte. I'm not aware of any such contention issue. IMHO the migration problem is majorly about being too slow transferring a page being so large. Shrinking the page size should resolve the major problem already here IIUC. AFAIU 4K-only solution should only reduce any lock contention because locks will always be pte-level if VM_HUGETLB_HGM set. When walking and creating the intermediate pgtable entries we can use atomic ops just like generic mm, so no lock needed at all. With uncertainty on the size of mappings, we'll need to take any of the multiple layers of locks. [...] > > None of these complexities are particularly major in my opinion. > > Perhaps not. I was just thinking about the overall complexity of the > hugetlb code after HGM. Currently, it is 'relatively simple' with > fixed huge page sizes. IMO, much simpler than THP with two possible > mapping sizes. With HGM and intermediate mapping sizes, it seems > things could get more complicated than THP. Perhaps it is just me. Please count me in. :) I'm just still happy to see what it'll look like if James think having that complexity doesn't greatly affect the whole design. Thanks, -- Peter Xu