Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp559128pxk; Wed, 2 Sep 2020 08:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWK+U9Qg+ATyGhNGCu5sZinhWHPK4LQRKRaBfkajwgtocCQHTAiATyo3zFfNXMa4qz4wfj X-Received: by 2002:a50:cdd1:: with SMTP id h17mr717629edj.94.1599061516660; Wed, 02 Sep 2020 08:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599061516; cv=none; d=google.com; s=arc-20160816; b=NVQbPN6fV3zGSgavX+hEfs6m/NaJaoKFtgDQsMn2EqZu6Om6xTF/xt4WEZ/6YT/IzQ 4Zq+Y74CTcKSW4dQbL1QrcMksGhHNNIFF0tE+jwuf2w8Qao4xucs7tJ3jL1dUqsE4JjY jByj8NaUBptmt0KtC8mgfYWlftO7AAfzwZ4xSOvw/jxBYSXng/kf89dFTPFRDGU8woUX rk3SMIS0yu8HZjsT04mSKnj7/qBsdAbjUiUqQpj55a/HUHjmgLA+hEEaXInObKtSlbH1 wmcXyQnWmR7pWVcl7TuKSY1D0UsIU70h0jI5/+c6/DG0LyP2s8jyWBitCXaScbnFn1I9 on8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XhnslE1OLag0DHeK+euiqo3OG83b3GpgX9BAplu24c8=; b=mTcqhSdUhjYRz75x/o2bIsNC/hpMHPdb39MsxiDcgM4Erhr7rz5G1GxPQT4qu2MYmi KOCRyUGwm7q2JqiG1+Ow94omi3jOAczhqK1HotnRMOAp8QoJD9lhUIXzSFP+azQMfBW2 3xPjiaNwdgr5lXsCoigeP7bvemZ9tjw+zKf/dcgw1+Woub0QexSweElC9U/AmtB/SgMC sR8KEdId6xwjnL/ZVj0lnxaRC8V0TEEFvDxAkz/FcBX5h8IGgF1Nhyb5PvcAU/qXVA9T VZ8cuPVWoC5bt781/Te0aJoBC37WcMuKGlnjHTIfVLiYeuIQzvbBWZcPQIVf7+uYYYCY cliw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=CnUkh8v0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z72si2780387ede.403.2020.09.02.08.44.42; Wed, 02 Sep 2020 08:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=CnUkh8v0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbgIBPmE (ORCPT + 99 others); Wed, 2 Sep 2020 11:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbgIBPlb (ORCPT ); Wed, 2 Sep 2020 11:41:31 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B2F6C061244 for ; Wed, 2 Sep 2020 08:41:30 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id c10so5381928edk.6 for ; Wed, 02 Sep 2020 08:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XhnslE1OLag0DHeK+euiqo3OG83b3GpgX9BAplu24c8=; b=CnUkh8v0k49RXvbWi1K7UXlLEVymEr3QK8zgyoIZRHlnSVMXyv/agG4kSnsqloTOMo qATIvnRA+rEtkHvSVfp6OorCYIKJNQxlEarTX6Y8x+kbgmFtLnbroBShdZKZD2pjBTys 7U5YQC5ltRh0IZCB5vjTTF9WA2Nec3QN1iuCj4Ma3qUQgMcei284L1Jon8ULiDGfZEk8 2D92SuDyP/6rrqZhhbA6kRmE4jNUAbFGlLwTnmJbz6QU0dL135Bh9P3L5bsFvvrzKmyu JqIa3aU1V7bpXRA9HtKzQrCrizmxg1A2+ueahLYpSzBUC27CH7Ot3NnP7M/n1KRrqI0+ 34MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XhnslE1OLag0DHeK+euiqo3OG83b3GpgX9BAplu24c8=; b=ORDA6HZpkC2VWeS08qLZonnolZLEv8x8IE3Hg5ujX/OvH5REssom3Cv1kx/uEqpMuH MLmVCTUiOCUSx8FtspDGWNFCNv3Eio5Q+M3g2Wj79O+y3NyvRabpD16iM5ydnJO7fxAP FrVpB7bCXTE1dQ7AxaQ/Qo12NXwAFXZoaRN91fCmbeSXaae0F+ejgE8I4LHpMdL3Jgyp TxEceESdKuh4njHlsYzfR94V65U2HywnmwwWQFAyTPBfQlrtXfRakLXXBAK8ZUgHy5q4 AWb7qFd3BZp1iGsonCXSeYiaHgTvk76KYR7/LsDRQOJ7fQlWu7aWyuVPdfrsuDCdvuTg 6tTA== X-Gm-Message-State: AOAM530sk+JKUkkOMNAJzrBgV34gqBDoUqkG1YWsm9cDidRb+Yisrp89 uBvHO3MSMM2e/Xn9GtB3+3lJgaX+IdgGQJQQOyPAuyJKYW66ZQ== X-Received: by 2002:a50:8f44:: with SMTP id 62mr690167edy.3.1599061289177; Wed, 02 Sep 2020 08:41:29 -0700 (PDT) MIME-Version: 1.0 References: <20200901124615.137200-1-pasha.tatashin@soleen.com> <20200902140851.GJ4617@dhcp22.suse.cz> <74f2341a-7834-3e37-0346-7fbc48d74df3@suse.cz> <20200902151306.GL4617@dhcp22.suse.cz> In-Reply-To: <20200902151306.GL4617@dhcp22.suse.cz> From: Pavel Tatashin Date: Wed, 2 Sep 2020 11:40:53 -0400 Message-ID: Subject: Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline To: Michal Hocko Cc: Vlastimil Babka , LKML , Andrew Morton , linux-mm Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > >> But this means that the page is not isolated and so it could be reused > > >> for something else. No? > > > > > > The page is in a movable zone, has zero references, and the section is > > > isolated (i.e. set_pageblock_migratetype(page, MIGRATE_ISOLATE);) is > > > set. The page should be offlinable, but it is lost in a pcp list as > > > that list is never drained again after the first failure to migrate > > > all pages in the range. > > > > Yeah. To answer Michal's "it could be reused for something else" - yes, somebody > > could allocate it from the pcplist before we do the extra drain. But then it > > becomes "visible again" and the loop in __offline_pages() should catch it by > > scan_movable_pages() - do_migrate_range(). And this time the pageblock is > > already marked as isolated, so the page (freed by migration) won't end up on the > > pcplist again. > > So the page block is marked MIGRATE_ISOLATE but the allocation itself > could be used for non migrateable objects. Or does anything prevent that > from happening? Vlastimil is right, we could allocate from pcplist, if someone requests allocation, nothing from what I can tell prevents that, and we will immediately migrate that page in do_migrate_range(). > We really do depend on isolation to not allow reuse when offlining. Once a page is isolated it is not re-used but here this page is not isolated because of the race between adding to pcp and isolation. Draining the second time on a failure fixes the race. Pasha