Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1733297rwb; Thu, 19 Jan 2023 14:53:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsCKIDtIagIaQoaM0jJ9CnEGlqDroukY6jvQr4NS87WDglwXvWEuteKvZgM3Pt/YYE8HiqH X-Received: by 2002:aa7:94ac:0:b0:58d:e33b:d562 with SMTP id a12-20020aa794ac000000b0058de33bd562mr8732474pfl.11.1674168791002; Thu, 19 Jan 2023 14:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674168790; cv=none; d=google.com; s=arc-20160816; b=G+vV9RLw9nmbNftDNn1OnOLjNIFlmc2DgkePnR+cqH6Ly76d4QwZ3v61Qad8m2IMgE ow27jcMZji42xc1RmBveI2yTAMGgkbcOHQAneYPSerI9K/jMIxWCsJF5jIPH15Xuf36n UXzjvvc5VsfxjGuRCK3YrmEDQr7fwTDrg1v8rg57cr8ePHujTA5HrQO9xzwuakCvtSfh 3A/DM7z6mHZdQ64XgFplLTtRgoWq6QgYvVUhNohQkEy7CSqeL3UmgR6ZKiyNJVJBment SHPZuml1oshw902GHV+9M1M1iajjtcUeCOXdOW0oevNkjkgZ9KW3MwczooACkSTDvLvn 6M+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KxWTZPauMXnpTaH3mq+4KakgefY9/3sGM9X+qHRltHo=; b=0HsoQG4E6eX21sB8Z/qK0FSxt2qi7z8cDYSs8jP9otXhm3pQMnpXh1igOuqpPeO19k /IiHi59vDmB6S77yS9wlbK5JxNBDUI3t7KKwFQ9YR1X6KHCpUIcFiEtfe+rt9t8VJ7UF zXjJuMXEjc09adx9VT8EdLYVSAWts8dm7Gw09n+1T7bZlO+OsKUr35S1zWKU1ERwFyMI FqcQf/M+/0D3+2aYRFMFKKZzg2eN/KK2a/xUF1IYwvhLfUDxqtaGKBXMWiF2TpV7Us9u HPAsbqkkriBFlSsubt5Dlj+95QJH0NqF1xzW1bmjURnZAs+Xcn2qHdmPK4LsICVivcow CPDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mr2BfM4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020aa782d3000000b0057791522cb6si1371107pfn.275.2023.01.19.14.53.04; Thu, 19 Jan 2023 14:53:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mr2BfM4g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbjASWm7 (ORCPT + 46 others); Thu, 19 Jan 2023 17:42:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbjASWmZ (ORCPT ); Thu, 19 Jan 2023 17:42:25 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 023BEB4E19 for ; Thu, 19 Jan 2023 14:23:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674166990; 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=Mr2BfM4gsKDAocFljRR4R36pPr+LsmPcuwZnQ2EoyR7pAdYaYSiK9w+nDxohrMeuw56RSh QnTDS/XtRq5nHoX+blOfCwafBvm+jIEk+YdTUBBS615Xamxkt4epwEqt0z5cJndSRguyy3 rqR1orfGAFBkyvh2fRAfetYR+BsYP44= 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-648-jYmHHfthN5aq2FcldYAV6g-1; Thu, 19 Jan 2023 17:23:09 -0500 X-MC-Unique: jYmHHfthN5aq2FcldYAV6g-1 Received: by mail-qt1-f200.google.com with SMTP id bs22-20020ac86f16000000b003b686e0ef0bso1598515qtb.19 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=ahZTd6XZfFD13/kmZwIwheDEMoNMZi4+TgiSjeVhOU8jjOp10vz87SsQRtcj7462/7 f4AnvnLnZZK+j0wXuQWwnMCbl1fBlIyWy+PeK6H/TNs6WE7nDAV0RYuC0ZyIw9uIU96V azXcgd6RsZj3wCvLjxzgQObEaKv9SWo0LSktqU92Qp/SgyhqPu3ccPcS7xb9WdeXtwlr aneksKSrGUi7shRIalU8cbcA7NAg/n6fFpZ+PHyr0wwZryixPnDTrVb0K+lhn2Ioiu8i 1dR3nOwvf+JJchS+2cFnnyJuEoM9j4UDmt/V+vHWUlQLikX0ONMRl2FSleoJvaVHc2aJ 0f4A== X-Gm-Message-State: AFqh2koDZ5ItD7XGQq3h1b9HUE1hHHWaEDFA3AOAFLaBKoGdFDmwNd0E BbSLfrKJB+l0d7QIgEOJiwIO6PBeeefwfhLGIREoNlm2BMfmzNE/kCGWRZj1liUmM/Y3+EGyW6j B4th5Lzp55/tKCpnqOqD/RWZo X-Received: by 2002:a05:6214:15d0:b0:519:ff36:a873 with SMTP id p16-20020a05621415d000b00519ff36a873mr19530730qvz.41.1674166988554; Thu, 19 Jan 2023 14:23:08 -0800 (PST) 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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