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 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B41C5ACD8 for ; Wed, 18 Mar 2020 13:58:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51D7F20767 for ; Wed, 18 Mar 2020 13:58:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DqCwxOMM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51D7F20767 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 030206B000D; Wed, 18 Mar 2020 09:58:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFC746B000E; Wed, 18 Mar 2020 09:58:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC3666B0010; Wed, 18 Mar 2020 09:58:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id C09106B000D for ; Wed, 18 Mar 2020 09:58:50 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7873D824556B for ; Wed, 18 Mar 2020 13:58:50 +0000 (UTC) X-FDA: 76608638820.12.ring84_875b150fa8b51 X-HE-Tag: ring84_875b150fa8b51 X-Filterd-Recvd-Size: 6859 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Mar 2020 13:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584539929; 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=WnUTOFtD/cSta3fxCQahLNV7ad9i2TrJ8jsNnx79ddw=; b=DqCwxOMMdZi84GFHgOJEfrAj00lRnOCFjcylWndgU0ANsLusJUJIyjjpxncTjpHjCodtHz JbDNS2RcTB8mPSgUGOw0CqrfB4ZcISu9IQLxKKONhxEdN4K7IOebDGpRHQlCCUsNVElR3y MiisVMCPObxnMh8eEr/2RBjQFKeU68k= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-HqS3RboRPdKgFmJR36VrTA-1; Wed, 18 Mar 2020 09:58:48 -0400 X-MC-Unique: HqS3RboRPdKgFmJR36VrTA-1 Received: by mail-wr1-f70.google.com with SMTP id b11so12375071wru.21 for ; Wed, 18 Mar 2020 06:58:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=F31yuOR6DS7mAZV1PpzPl5tjjIYKtGbdeccjup64HTg=; b=QsZYuHw0anrc/dN2e9/6zG3rnVv665FUtXlGiyywzCSpvDAZxeBDUvUBkpZpsFYTv6 kg/HnENUSzD1Chqwg0+mj2xR1Pek5KssZxd4Rl2PvRtcNpYXCgGVApOhwiGV16lbQewv Cdt6u4aGobo/ttVECWWnEP7Xp5p9QqBStgTl2A8oaEeVN7Dd3DAEq0hsCFA5aXDc3w0X GrZ03QmDTyXSEYmiLKdEwxbCrOtbKav5lSshj+p43o6V6Q5wpNoNzDeN7w8yudS9f90x 02Wri9KfpxPHvhQwnyyVXPlPYs9/bU9ReCqRF9/IUwSGYbYS3iIiF7/oL2SPoSHX+IkK ZE5g== X-Gm-Message-State: ANhLgQ19n+mtibOsE8Tfky0cRM8fEvx5eisU0dlRaF39NkPsjsJqSjKd wLpk6W71mrXRiyRan4KIGibVyg1dRwdwAstAp0I4gYYSRFDhbqVJ2ohu6daI7oBhPPmMWLrN7Yj fSnqstp+XRNI= X-Received: by 2002:a1c:e442:: with SMTP id b63mr5559733wmh.174.1584539927048; Wed, 18 Mar 2020 06:58:47 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuOzuNgvDkbFkbElCg5edIwU+8StaNxg5QEC0tTkAdX0Cu7G9Ynuwj6chgem6WJSymuM5v0dQ== X-Received: by 2002:a1c:e442:: with SMTP id b63mr5559631wmh.174.1584539925803; Wed, 18 Mar 2020 06:58:45 -0700 (PDT) Received: from vitty.brq.redhat.com (g-server-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id q10sm9136178wrx.12.2020.03.18.06.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 06:58:45 -0700 (PDT) From: Vitaly Kuznetsov To: Baoquan He , David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, Yumei Huang , Igor Mammedov , Eduardo Habkost , Milan Zamazal , Andrew Morton , Benjamin Herrenschmidt , Greg Kroah-Hartman , Haiyang Zhang , "K. Y. Srinivasan" , Michael Ellerman , Michal Hocko , Michal Hocko , Oscar Salvador , Paul Mackerras , "Rafael J. Wysocki" , Stephen Hemminger , Wei Liu , Wei Yang Subject: Re: [PATCH v2 0/8] mm/memory_hotplug: allow to specify a default online_type In-Reply-To: <20200318130517.GC30899@MiWiFi-R3L-srv> References: <20200317104942.11178-1-david@redhat.com> <20200318130517.GC30899@MiWiFi-R3L-srv> Date: Wed, 18 Mar 2020 14:58:43 +0100 Message-ID: <87d0993gto.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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: Baoquan He writes: > On 03/17/20 at 11:49am, David Hildenbrand wrote: >> Distributions nowadays use udev rules ([1] [2]) to specify if and >> how to online hotplugged memory. The rules seem to get more complex with >> many special cases. Due to the various special cases, >> CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE cannot be used. All memory hotplug >> is handled via udev rules. >>=20 >> Everytime we hotplug memory, the udev rule will come to the same >> conclusion. Especially Hyper-V (but also soon virtio-mem) add a lot of >> memory in separate memory blocks and wait for memory to get onlined by u= ser >> space before continuing to add more memory blocks (to not add memory fas= ter >> than it is getting onlined). This of course slows down the whole memory >> hotplug process. >>=20 >> To make the job of distributions easier and to avoid udev rules that get >> more and more complicated, let's extend the mechanism provided by >> - /sys/devices/system/memory/auto_online_blocks >> - "memhp_default_state=3D" on the kernel cmdline >> to be able to specify also "online_movable" as well as "online_kernel" > > This patch series looks good, thanks. Since Andrew has merged it to -mm a= gain, > I won't add my Reviewed-by to bother.=20 > > Hi David, Vitaly > > There are several things unclear to me. > > So, these improved interfaces are used to alleviate the burden of the=20 > existing udev rules, or try to replace it? As you know, we have been > using udev rules to interact between kernel and user space on bare metal, > and guests who want to hot add/remove. With 'auto_online_blocks' interface you don't need the udev rule. David is trying to make it more versatile. > > And also the OOM issue in hyperV when onlining pages after adding memory > block. I am not a virt devel expert, could this happen on bare metal > system? Yes - in theory, very unlikely - in practice. The root cause of the problem here is adding more memory to the system requires memory (page tables, memmaps,..) so if your system is low on memory and you're trying to hotplug A LOT you may run into OOM before you're able to online anything. With bare metal it's usualy not the case: servers, which are able to hotplug memory, are usually booted with enough memory and memory hotplug is a manual action (you need to insert DIMMs!). But, if you boot your server with e.g. 4G, almost exhaust it and then try to hotplug e.g. 256G ... well, OOM is almost guaranteed. With virtual machines it's very common (e.g. with Hyper-V VMs) to boot them with low memory and hotplug it (automatically, by some management software) when neededm thus the problem is way more common. --=20 Vitaly