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 67A03C433F5 for ; Thu, 12 May 2022 16:38:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D07788D0001; Thu, 12 May 2022 12:38:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB5326B0075; Thu, 12 May 2022 12:38:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7D7C8D0001; Thu, 12 May 2022 12:38:51 -0400 (EDT) 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 A6B946B0074 for ; Thu, 12 May 2022 12:38:51 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 7A33F80668 for ; Thu, 12 May 2022 16:38:51 +0000 (UTC) X-FDA: 79457650062.09.C9A8056 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 9E3151000AC for ; Thu, 12 May 2022 16:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652373530; 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=mp/k4+ROOQmqxpZwmJD0fhrk0KhPBsBL98sUg/4FvV4=; b=FO8DCwvg9XVsGepcd2Ml2n9NKAiwNzGTRD1t9DwQNQS+AOXxdncG5CjpBZWZ6tjeooO67j C8z2DL8Cx/j3PqrmylzETzJq+uLbcSQjBmmgFJOP7l/Xk63cK9qT5GoV1ZbKbIJeoGVHG0 LRDONLlGa6Nr2jL2fwIi8QsUFGlWZso= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-w-7WIHMYP82I8haohMMw4A-1; Thu, 12 May 2022 12:38:49 -0400 X-MC-Unique: w-7WIHMYP82I8haohMMw4A-1 Received: by mail-wm1-f69.google.com with SMTP id s14-20020a05600c29ce00b00394611a8059so4614448wmd.4 for ; Thu, 12 May 2022 09:38:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=mp/k4+ROOQmqxpZwmJD0fhrk0KhPBsBL98sUg/4FvV4=; b=PTk9tIzpJb9Zc1rIs0V61jM+Udby6kzkQpk1834iLGMf+XQjWE4IC7pPKrB+fc96WC mFJG8Bp9LP7D+6zNHEzOA+DrMZnThQR5IaF+eDRAEXwNVE/PkpK87i5LyNy5W0u3Sl3q bPyoS6zZ4lHuV+UY1QX2on8NLAm9YGHhSTdX2mVk1DKG/Nz+0BYTIy3fRgVv9gYEqtoX UY1iSDVhabFL/iQo90ROCjgKy1EHNj3OAVRptpHhAuCylGCC9acBormEvc+Em5admIJJ olSv67kuv/GZo+8ZF+yLlxHf+SsMvnwyCxknR+tq8ui56fGZHq/6XGH8PyQgUvsnssVi SMrQ== X-Gm-Message-State: AOAM532W3h8qwPWJ6g19BtJLNMMNtDTlk/CCHdST9ehT1VyWOcZU5ksn yl8/zSyM5uQbS/BTSRHo2HZOQIyfNO67+58oY5xSLpNvu32vdvqQFdAslFsQ71X6MOiZ2v9CiZz Ey0DCU/3xaDk= X-Received: by 2002:a5d:52c5:0:b0:1f2:1a3:465a with SMTP id r5-20020a5d52c5000000b001f201a3465amr486464wrv.206.1652373527734; Thu, 12 May 2022 09:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw//xNJoDYn5jy5VfLK8EYdFrB0LMzS/0yyqB5elC7RCc26OTEcBI18h7H0GbGJR3KT78tEog== X-Received: by 2002:a5d:52c5:0:b0:1f2:1a3:465a with SMTP id r5-20020a5d52c5000000b001f201a3465amr486433wrv.206.1652373527464; Thu, 12 May 2022 09:38:47 -0700 (PDT) Received: from ?IPV6:2003:cb:c701:d200:ee5d:1275:f171:136d? (p200300cbc701d200ee5d1275f171136d.dip0.t-ipconnect.de. [2003:cb:c701:d200:ee5d:1275:f171:136d]) by smtp.gmail.com with ESMTPSA id j10-20020adfc68a000000b0020c635ca28bsm2219wrg.87.2022.05.12.09.38.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 May 2022 09:38:45 -0700 (PDT) Message-ID: <5ca142fd-c7c0-768d-39f4-c58a84fff1f7@redhat.com> Date: Thu, 12 May 2022 18:38:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v10 2/4] mm: memory_hotplug: override memmap_on_memory when hugetlb_free_vmemmap=on To: Muchun Song Cc: corbet@lwn.net, mike.kravetz@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, masahiroy@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com References: <20220509062703.64249-1-songmuchun@bytedance.com> <20220509062703.64249-3-songmuchun@bytedance.com> <284eec3f-a79d-c5f0-3cd6-53b8e64100cd@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: jmda4unrj5xm3yx9nwp3rcnwh8jsc6k7 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9E3151000AC X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FO8DCwvg; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1652373528-87716 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 12.05.22 15:59, Muchun Song wrote: > On Thu, May 12, 2022 at 03:04:57PM +0200, David Hildenbrand wrote: >> On 12.05.22 14:50, Muchun Song wrote: >>> On Thu, May 12, 2022 at 09:36:15AM +0200, David Hildenbrand wrote: >>>> On 09.05.22 08:27, Muchun Song wrote: >>>>> Optimizing HugeTLB vmemmap pages is not compatible with allocating memmap on >>>>> hot added memory. If "hugetlb_free_vmemmap=on" and >>>>> memory_hotplug.memmap_on_memory" are both passed on the kernel command line, >>>>> optimizing hugetlb pages takes precedence. >>>> >>>> Why? >>>> >>> >>> Because both two features are not compatible since hugetlb_free_vmemmap cannot >>> optimize the vmemmap pages allocated from alternative allocator (when >>> memory_hotplug.memmap_on_memory=1). So when the feature of hugetlb_free_vmemmap >>> is introduced, I made hugetlb_free_vmemmap take precedence. BTW, I have a plan >>> to remove this restriction, I'll post it out ASAP. >> >> I was asking why vmemmap optimization should take precedence. >> memmap_on_memory makes it more likely to succeed memory hotplug in >> close-to-OOM situations -- which is IMHO more important than a vmemmap >> optimization. >> > > I thought the users who enable hugetlb_free_vmemmap value memory > savings more, so I made a decision in commit 4bab4964a59f. Seems > I made a bad decision from your description. Depends on the perspective I guess. :) > >> But anyhow, the proper approach should most probably be to simply not >> mess with the vmemmap if we stumble over a vmemmap that's special due to >> memmap_on_memory. I assume that's what you're talking about sending out. >> > > I mean I want to have hugetlb_vmemmap.c do the check whether the section > which the HugeTLB pages belong to can be optimized instead of making > hugetlb_free_vmemmap take precedence. E.g. If the section's vmemmap pages > are allocated from the added memory block itself, hugetlb_free_vmemmap will > refuse to optimize the vmemmap, otherwise, do the optimization. Then > both kernel parameters are compatible. I have done those patches, but > haven't send them out. Yeah, that's exactly what I thought. How complicated are they? If they are easy, can we just avoid this patch here and do it "properly"? :) -- Thanks, David / dhildenb