Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1325692rwp; Thu, 13 Jul 2023 09:11:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFBM+D9NLkIBdxSIg3aohjPxQHa0TFtjlnEUhmZOF4kv8mnBj3o0al8N/s6KtAxlKsbw05i X-Received: by 2002:a2e:3a1a:0:b0:2b6:e2c6:6e1c with SMTP id h26-20020a2e3a1a000000b002b6e2c66e1cmr1912395lja.14.1689264698792; Thu, 13 Jul 2023 09:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689264698; cv=none; d=google.com; s=arc-20160816; b=oRWfq/AR5pCRNp4M3vrVQaoomhIjh6Lm6a5fn9XDGtlb3zuGQ0kYhWb4GhHsWIXDi1 xxFmPmlRwv58DZewGCbB33Ernn1+GUWcFP3mTX+j82IDGW8cC34O78phu9FsiVnlAWBY Zkzb3UBDYArSTXPzaYs/ZShe8PvrxcJjSvFSuhoViAgmziMdsyMF0H383cUMJB0wZ1JC JoD18X5sCo7nOre1R4x9BpJeXFFviO1XKE9762woMZ1+IR7jPhKx/iqIDDY/IsCOqALO wtWrBLqSIoS6FJZp2e/+xU2c+kbaeA+gO6JvKCjA5GF5lZsQJ+z8r2QWqSpaYgRvB2v9 hALg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=VLikHNWVNU/FNpgKCSfkRGEY/lyXivfIFOAmn8fr+kQ=; fh=h8z6s0Ua3BNt2PPRGfbP3QGSTY8+li3ewceYNGlMumU=; b=uUx9FTv3HLqGiJw8tuo2IuaLk0vPWPl18CtYWjfFVx48UXpcfIMnN62Kma2sAzGvnN M7tpptkLJSwDGkpL/nPQaV0p90YW7IIksryouUYOchIswyD6EimlbPI5KBQ64sJ/Co/4 AJR+wT5i0nKYsx/2ifDRNk4tDF29FvWdQmS0X/Af5AyQwxOKVnkvgqTKomnHRrwUmXSz 6BmtOjNm3pwCo3ldsoGLQgUmxL1R8dVjo8qLwbE2NvvfUVwFMQ95EWOQ+KYslRUAUOln aplf9ta6B25M53fHmuHvP2YO9nE4/A8EMoGfn6YqHguhaKAfIk+BrXysG6erSRLmqhbU mPYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RnRJ9f2h; 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 j4-20020a170906278400b009924806cd0asi7545863ejc.295.2023.07.13.09.11.14; Thu, 13 Jul 2023 09:11:38 -0700 (PDT) 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=RnRJ9f2h; 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 S235078AbjGMPoP (ORCPT + 99 others); Thu, 13 Jul 2023 11:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234969AbjGMPoL (ORCPT ); Thu, 13 Jul 2023 11:44:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EBEE273B for ; Thu, 13 Jul 2023 08:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689263008; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VLikHNWVNU/FNpgKCSfkRGEY/lyXivfIFOAmn8fr+kQ=; b=RnRJ9f2hV9KFiM7Xk5Ut3MOs/qpRGiSwWpoy0hme7Itvu49LgZiVbcXGHs4jOPgmH/jItQ aj3E5HLoL2tJ70y3YGtGtdF6tcQo4Txj/FQ5UbUKQAQAIziQbrnuZWh4mcMa4mZQL9FqCP aCvK8yNOpBllCvoi0aKecccHDj7AYEc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-tRcAHoETOw6FckLN5qqehg-1; Thu, 13 Jul 2023 11:43:26 -0400 X-MC-Unique: tRcAHoETOw6FckLN5qqehg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-31596170243so622681f8f.1 for ; Thu, 13 Jul 2023 08:43:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689263005; x=1691855005; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VLikHNWVNU/FNpgKCSfkRGEY/lyXivfIFOAmn8fr+kQ=; b=BkedGY1XrvRfKWiwCgErd7VL7mxy89L4b56FnIdPAWTrrgj6T6mlNFEAgqx80ghRuI VV0l1gtjgJrIP4I2en8GUzU1wS9zhh+4AwfXMkHqN1y3ksab9qumGt1jtIy93R0tFzDJ ECRERQaQUa3epJMnE9gBYnq0OexhrNcrjG6Hta6ZqRG4DIcmEH0P2h7pCx/jgsD1mYc8 140iTcGNHl0ZjFsNAUpgqWKXZU2Y743o7a05ZCnCnughnUX044lpgY8kei1qtn/tOESv UlRuXGzjf19Q2ZcNxOnpHz+zp9a2VrGYbEQEoTpfHDhNOIP9rbBCl+knm3dAHInFgVgw X4Kw== X-Gm-Message-State: ABy/qLZ5thwdG7oTIKIHPjpXPMumAwgB2JP9W7DLWtGUaSDdz+sY22Dt vVmklhIwwlWLRPsG0VpsDmTSPGOTBkKFHYwXCP4derAClC4Hvtf9eFPveGGRlDr81jcJD27/Mb7 HHSVzGm858G9UXVYi2x+H8gZo X-Received: by 2002:adf:e681:0:b0:313:f4e2:901d with SMTP id r1-20020adfe681000000b00313f4e2901dmr2049831wrm.22.1689263004839; Thu, 13 Jul 2023 08:43:24 -0700 (PDT) X-Received: by 2002:adf:e681:0:b0:313:f4e2:901d with SMTP id r1-20020adfe681000000b00313f4e2901dmr2049814wrm.22.1689263004497; Thu, 13 Jul 2023 08:43:24 -0700 (PDT) Received: from ?IPV6:2003:cb:c717:6100:2da7:427e:49a5:e07? (p200300cbc71761002da7427e49a50e07.dip0.t-ipconnect.de. [2003:cb:c717:6100:2da7:427e:49a5:e07]) by smtp.gmail.com with ESMTPSA id o7-20020a5d6707000000b002c70ce264bfsm8285044wru.76.2023.07.13.08.43.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jul 2023 08:43:24 -0700 (PDT) Message-ID: Date: Thu, 13 Jul 2023 17:43:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 3/3] dax/kmem: Always enroll hotplugged memory for memmap_on_memory Content-Language: en-US To: "Verma, Vishal L" , "akpm@linux-foundation.org" , "rafael@kernel.org" , "osalvador@suse.de" , "aneesh.kumar@linux.ibm.com" , "Williams, Dan J" , "Jiang, Dave" , "lenb@kernel.org" Cc: "Huang, Ying" , "linux-mm@kvack.org" , "linux-cxl@vger.kernel.org" , "nvdimm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "dave.hansen@linux.intel.com" References: <20230613-vv-kmem_memmap-v1-0-f6de9c6af2c6@intel.com> <20230613-vv-kmem_memmap-v1-3-f6de9c6af2c6@intel.com> <87edleplkn.fsf@linux.ibm.com> <1df12885-9ae4-6aef-1a31-91ecd5a18d24@redhat.com> <5a8e9b1b6c8d6d9e5405ca35abb9be3ed09761c3.camel@intel.com> <6cb5624ebf3039b18f5180262fc6383b402d26ea.camel@intel.com> <80c8654e-21fb-b187-3475-9a1410a53a4e@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 13.07.23 17:40, Verma, Vishal L wrote: > On Thu, 2023-07-13 at 17:23 +0200, David Hildenbrand wrote: >> On 13.07.23 17:15, Verma, Vishal L wrote: >>> On Thu, 2023-07-13 at 09:23 +0200, David Hildenbrand wrote: >>>> On 13.07.23 08:45, Verma, Vishal L wrote: >>>>> >>>>> I'm taking a shot at implementing the splitting internally in >>>>> memory_hotplug.c. The caller (kmem) side does become trivial with this >>>>> approach, but there's a slight complication if I don't have the module >>>>> param override (patch 1 of this series). >>>>> >>>>> The kmem diff now looks like: >>>>> >>>>>      diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c >>>>>      index 898ca9505754..8be932f63f90 100644 >>>>>      --- a/drivers/dax/kmem.c >>>>>      +++ b/drivers/dax/kmem.c >>>>>      @@ -105,6 +105,8 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) >>>>>              data->mgid = rc; >>>>> >>>>>              for (i = 0; i < dev_dax->nr_range; i++) { >>>>>      +               mhp_t mhp_flags = MHP_NID_IS_MGID | MHP_MEMMAP_ON_MEMORY | >>>>>      +                                 MHP_SPLIT_MEMBLOCKS; >>>>>                      struct resource *res; >>>>>                      struct range range; >>>>> >>>>>      @@ -141,7 +143,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) >>>>>                       * this as RAM automatically. >>>>>                       */ >>>>>                      rc = add_memory_driver_managed(data->mgid, range.start, >>>>>      -                               range_len(&range), kmem_name, MHP_NID_IS_MGID); >>>>>      +                               range_len(&range), kmem_name, mhp_flags); >>>>> >>>>>                      if (rc) { >>>>>                              dev_warn(dev, "mapping%d: %#llx-%#llx memory add failed\n", >>>>> >>>>> >>>> >>>> Why do we need the MHP_SPLIT_MEMBLOCKS? >>> >>> I thought we still wanted either an opt-in or opt-out for the kmem >>> driver to be able to do memmap_on_memory, in case there were >>> performance implications or the lack of 1GiB PUDs. I haven't >>> implemented that yet, but I was thinking along the lines of a sysfs >>> knob exposed by kmem, that controls setting of this new >>> MHP_SPLIT_MEMBLOCKS flag. >> >> Why is MHP_MEMMAP_ON_MEMORY not sufficient for that? >> >> > Ah I see what you mean now - knob just controls MHP_MEMMAP_ON_MEMORY, > and memory_hotplug is free to split to memblocks if it needs to to > satisfy that. And if you don't want memmap holes in a larger area you're adding (for example to runtime-allocate 1 GiB pages), simply check the size your adding, and if it's, say, less than 1 G, don't set the flag. But that's probably a corner case use case not worth considering for now. > > That sounds reasonable. Let me give this a try and see if I run into > anything else. Thanks David! Sure! -- Cheers, David / dhildenb