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=-4.1 required=3.0 tests=BAYES_00,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 7FEBAC433E2 for ; Wed, 2 Sep 2020 15:41:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BDAE20829 for ; Wed, 2 Sep 2020 15:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="CnUkh8v0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BDAE20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 945886B0062; Wed, 2 Sep 2020 11:41:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F5136B006C; Wed, 2 Sep 2020 11:41:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E4316B0078; Wed, 2 Sep 2020 11:41:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 64F476B0062 for ; Wed, 2 Sep 2020 11:41:31 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1D1538248D51 for ; Wed, 2 Sep 2020 15:41:31 +0000 (UTC) X-FDA: 77218535982.11.look44_4a0e367270a2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id E230F180F8B81 for ; Wed, 2 Sep 2020 15:41:30 +0000 (UTC) X-HE-Tag: look44_4a0e367270a2 X-Filterd-Recvd-Size: 4391 Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Sep 2020 15:41:30 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id c8so5394954edv.5 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=QY4nM6C6IJzCk01fyAM+e61VZjGn3a3YXABf+EeDpjHZfTswPfRNjH92mxcVvjd35l 4wh6kxQievpub6tQXf5sc4n9NJhlGnRDZJktTyuLSw8D8iqvRd2GdB6TXlftYBvSmhsw WAGiMa2OyKD0dx/pRvVlweXlCGDCR67GAS7AOmlH7khCNcQxGaGH19AuNo9f6EC7GMSs 9KInn0yRZYs5NdvhYqvbkW2hw9bD5VN2BSpYJzfkFGtDnNm8ORE6bSMLdsnjAt2Aa2qk VaYivTpujNVYHafuLL18eDblM8Nw3yF0azAzqdG+8lSn0RxXYH343Krtwml1ZkyO7aw0 eJhQ== X-Gm-Message-State: AOAM531hLd/JcSO0t0iWJJSauoZk2vNfhq030WZenZ8J+9/5J/dGraQH dPtrZpAI7UqXbOoR0gnNmynAwyVy2mAptACteTwgKA== X-Google-Smtp-Source: ABdhPJzS3/Y2wZVi6sOOyA5MepX0s8tx2YjOOIPDoaQ2guEabmxZNcLw7pZtzCptADfNCUBLLTTpQ113qGsuNrrTBco= 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" X-Rspamd-Queue-Id: E230F180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.084499, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > > >> 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