Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp509756pxk; Wed, 2 Sep 2020 07:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXRFItfcPm+N3AEEPMR+qNGFyiOZfcuoDw8Hon0W1wylqSs8PyJVhYDDAdTw06EqtkM7CU X-Received: by 2002:a17:906:4c58:: with SMTP id d24mr365739ejw.108.1599057424979; Wed, 02 Sep 2020 07:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599057424; cv=none; d=google.com; s=arc-20160816; b=1BCoPqxOfJgNQw+Ocbutidcoka0BtEAF53tNg+RpNDjjYzU7NuRgUublLrJ4eowjyo tRRRVolxq58rX6AzGrLqibMQbRgbdpkggRuK+vMCSigsh3A0nUlcFosZnUp6DYqNjcba lQHsM571xssTjCdSvE6fqTcc5UKKPxfMFgOXrr3HrwajtQX6A8106R7TJutcGgJW7HvC XCDqj73IQ+3CNYjO85sHI7PUrVmMlQZJHL0TmpNJepgEr3OFA+3g9hMypyY9fl1ffHlr p9z+NhM82ClatP0RE8nuFIUchue8Sf1L/hFSZQiak4kgKoGiyuMuujNTqRArs1MtqHZK Ic+A== 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=bItmxO/box4xkUA8NKzf+RG/lZQ2k+Z9iLxIKAdl3rg=; b=RoW8KetKqHtKocyYntTojZnOLxk/wJHeyN2xkIdivOoqQ9edXOGCYcs93GztMDMzLT nRfI73G5f0iEaBDTUkf3LYwh5vFThvRvfqrEBQeVFDeUhee9GXIXyZJdWHQLBFd+LR2d EATdN9pjx7Vlem/5/4aZinJmQWshX0K7L/3k3Me2sd6/LOVxiu7EV815KZPOvMT8tpyt 7d1rZK5cfwLAIf/L8rpherUSCFUKc5wy4KH7Xr7Ulk99GLZaC8LWKT4vXxwByFUvzMHj 5C4NEIVf2mz4GyZXpYcKP47ZJNKV3jsoFS29sL1qGypwpZrGsGLD1nv5XRP33cnPvEDk PHfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=aVOjgIgh; 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 bm12si2713188ejb.186.2020.09.02.07.36.39; Wed, 02 Sep 2020 07:37:04 -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=aVOjgIgh; 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 S1726853AbgIBOcr (ORCPT + 99 others); Wed, 2 Sep 2020 10:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbgIBOc0 (ORCPT ); Wed, 2 Sep 2020 10:32:26 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A39EAC061244 for ; Wed, 2 Sep 2020 07:32:25 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id n13so5140155edo.10 for ; Wed, 02 Sep 2020 07:32:25 -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=bItmxO/box4xkUA8NKzf+RG/lZQ2k+Z9iLxIKAdl3rg=; b=aVOjgIghf/LEOqFr9f4cUaGIB9aNDSyALYlLsC+VQPNplfPqFtVW5Qz+ox/xFwMdpG jB7beowphCRkU5QDzWrb1EIupdF/v2r4RrLTeTNLFjTKFbZT7NXvgjlyT110in7Hx4dz 8GpNde4P1H361ikv41rISWFetQY8pv60aCfHVotYKc+9S1z/8/DbWq6/tv6WzUJv8SKX DCirYhdgoK+EpYuOQ8MlWhfwnFl74/BPW+p0nPJCl193hT7+N0RKmg2ztMkUn5l5Z0Bb UWhbiXJwo5yKScy0+CLjd2d6INwPCv6lmQoNSeG44B0Q2AYK8pFHtFdXOrkgqZyeW7eD VTmQ== 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=bItmxO/box4xkUA8NKzf+RG/lZQ2k+Z9iLxIKAdl3rg=; b=iS6WuH0FSb+mp7WEIf44wQ9NQAXtjQ88E2rf384OmQH3QxXIsuQE+ObkptmPFGxDpz I8DxLwXLNzXSPTkOGK3gaGzNvRAzt+Bih67jnQNzVztR0ImD8aFILcMIpjA+fOpuPXu6 +d3i0Q8m8A2E6UNh419GWVdtmWmTYVQuKf6Kqv4vFlGqThyV3wh/vQ0NtZlOYuDPBsSr foyZAbZ3PCEO1yGkedgA0HXfUwbz5vd5zeUVDCsj0d9XbgdfZFJdptKvV6qzCDshl7OC uehkXZw62f2OiD34OsSCP3OdIRDd5MEvdIK1UNBOsLPOCRu8tuNHdvFMaBxUrD3auvLi RYvg== X-Gm-Message-State: AOAM531tjlJXYnwn0osShMVxbIXyMPIj3hzI/SKFTC4YnEoOjotXgN9W sniVXP3rGewAcEGXy/RMZTk4gD+A8p8Y0cMd5sgZew== X-Received: by 2002:aa7:de91:: with SMTP id j17mr345344edv.85.1599057144195; Wed, 02 Sep 2020 07:32:24 -0700 (PDT) MIME-Version: 1.0 References: <20200901124615.137200-1-pasha.tatashin@soleen.com> <20200902140116.GI4617@dhcp22.suse.cz> <20200902141057.GK4617@dhcp22.suse.cz> In-Reply-To: <20200902141057.GK4617@dhcp22.suse.cz> From: Pavel Tatashin Date: Wed, 2 Sep 2020 10:31:48 -0400 Message-ID: Subject: Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline To: Michal Hocko Cc: LKML , Andrew Morton , linux-mm , Vlastimil Babka , Mel Gorman 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 > > > The fix is to try to drain per-cpu lists again after > > > check_pages_isolated_cb() fails. > > Still trying to wrap my head around this but I think this is not a > proper fix. It should be the page isolation to make sure no races are > possible with the page freeing path. > As Bharata B Rao found in another thread, the problem was introduced by this change: c52e75935f8d: mm: remove extra drain pages on pcp list So, the drain used to be tried every time with lru_add_drain_all(); Which, I think is excessive, as we start a thread per cpu to try to drain and catch a rare race condition. With the proposed change we drain again only when we find such a condition. Fixing it in start_isolate_page_range means that we must somehow synchronize it with the release_pages() which adds costs to runtime code, instead of to hot-remove code. Pasha