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=-1.0 required=3.0 tests=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 ABEF4C3F2D2 for ; Mon, 2 Mar 2020 12:48:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5111021739 for ; Mon, 2 Mar 2020 12:48:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5111021739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A83C36B0006; Mon, 2 Mar 2020 07:48:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A34FE6B0007; Mon, 2 Mar 2020 07:48:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94B166B0008; Mon, 2 Mar 2020 07:48:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 835516B0006 for ; Mon, 2 Mar 2020 07:48:55 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5412B8248076 for ; Mon, 2 Mar 2020 12:48:55 +0000 (UTC) X-FDA: 76550401830.10.scent15_30c696863cd21 X-HE-Tag: scent15_30c696863cd21 X-Filterd-Recvd-Size: 4431 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Mar 2020 12:48:55 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id a5so11047096wmb.0 for ; Mon, 02 Mar 2020 04:48:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=s+VyaNhmOd6f42VIDi6KHAKXCWAclUlFckZ+VTZz/lc=; b=bFg/ur6Nx04FlY5aOFw1Ze8DAlwcp8Ypv1jV9tnIMt1xD4VzDCtQ/3HLHEJ3Jw29P3 JYMKBIMPZ3uBCG3oJNYgeM7y0f3Lbp9JcmaRuisZr0tOXzoynNxJ7tHrV95fnHGap4lc 1YjeAgpgWagdQeCs3M1vFXZ/wnsIA1lycr61cZG5HwVlfg1SphUi3RKPIp3dpRaEyGRM gcATY6tuMUnDZhpqefyFyBPPJecqKOMt7MpFiXBIIo51nDzKVhqRzgMq9hjoXcqTsa+Z 4mLHr1AvNK2dy6XrWmLpZwlULVasVN0Rn0FrXM2zcaryJPt3h3LnSuQ6pHhIDR4WJm24 b/ow== X-Gm-Message-State: ANhLgQ1ExTIVgIvGeBioR8WnHJKgf0b8u1wAbkjiJvR+6sShEKfJNKqX frEElsbjCND1QsYKR6xHOm4= X-Google-Smtp-Source: ADFU+vu2qgToohf1Ho0XOtqDdOYGWkWtP/VPHfRQw8HJnTcjtKh7DPXkwvVpSUhS0/HRLDYCsIxTfA== X-Received: by 2002:a7b:cc69:: with SMTP id n9mr2851092wmj.175.1583153333837; Mon, 02 Mar 2020 04:48:53 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id z14sm28071107wru.31.2020.03.02.04.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2020 04:48:53 -0800 (PST) Date: Mon, 2 Mar 2020 13:48:52 +0100 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtio-dev@lists.oasis-open.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, Andrew Morton , "Michael S . Tsirkin" , Oscar Salvador , Pavel Tatashin , Wei Yang , Dan Williams , Qian Cai Subject: Re: [PATCH RFC v4 08/13] mm/memory_hotplug: Introduce offline_and_remove_memory() Message-ID: <20200302124852.GJ4380@dhcp22.suse.cz> References: <20191212171137.13872-1-david@redhat.com> <20191212171137.13872-9-david@redhat.com> <20200225141134.GU22443@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue 25-02-20 15:27:28, David Hildenbrand wrote: > On 25.02.20 15:11, Michal Hocko wrote: > > On Thu 12-12-19 18:11:32, David Hildenbrand wrote: > >> virtio-mem wants to offline and remove a memory block once it unplugged > >> all subblocks (e.g., using alloc_contig_range()). Let's provide > >> an interface to do that from a driver. virtio-mem already supports to > >> offline partially unplugged memory blocks. Offlining a fully unplugged > >> memory block will not require to migrate any pages. All unplugged > >> subblocks are PageOffline() and have a reference count of 0 - so > >> offlining code will simply skip them. > >> > >> All we need an interface to trigger the "offlining" and the removing in a > >> single operation - to make sure the memory block cannot get onlined by > >> user space again before it gets removed. > > > > Why does that matter? Is it really likely that the userspace would > > interfere? What would be the scenario? > > I guess it's not that relevant after all (I think this comment dates > back to the times where we didn't have try_remove_memory() and could > actually BUG_ON() in remove_memory() if there would have been a race). > Can drop that part. > > > > > Or is still mostly about not requiring callers to open code this general > > patter? > > From kernel module context, I cannot get access to the actual memory > block device (find_memory_block()) and call the device_unregister(). > > Especially, also the device hotplug lock is not exported. So this is a > clean helper function to be used from kernel module context. (e.g., also > hyper-v showed interest for using that) Fair enough. -- Michal Hocko SUSE Labs