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 5AD81C433E7 for ; Wed, 2 Sep 2020 14:32:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13F83207D3 for ; Wed, 2 Sep 2020 14:32:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="aVOjgIgh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13F83207D3 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 9DD1F6B0087; Wed, 2 Sep 2020 10:32:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9675B900004; Wed, 2 Sep 2020 10:32:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82E876B008A; Wed, 2 Sep 2020 10:32:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 698E56B0087 for ; Wed, 2 Sep 2020 10:32:26 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 204D9180AD80F for ; Wed, 2 Sep 2020 14:32:26 +0000 (UTC) X-FDA: 77218361892.22.dolls04_0105e61270a1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id DDC8018038E6C for ; Wed, 2 Sep 2020 14:32:25 +0000 (UTC) X-HE-Tag: dolls04_0105e61270a1 X-Filterd-Recvd-Size: 3642 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Sep 2020 14:32:25 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id c10so5140222edk.6 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=kBOhxEq46O7A2pZnFFl9NdOGmgOmZy580fyl0cgWBg1IIpVoeuIQwoW6S4wqii9Dwm 1P8mi5rW5crJZWxOUftrrCq0NBGTcM6oLW7KB6E4wmc/a/MfQXCSJGISAu1U4EmiUE/s qWVu1FQcQ34Jz0nvTn8GdFptzMv1vZecIMxrenmQuQSPGrPYOs5c4kcF4UMDX0GHt5eo g3/IQkuDukgJqVa5gvj/vYytsPnT5mdX4JI61lZnWv/OirPVKwATChxOjoQSkoVtmsk7 CreiKeqx5cLle7BSlbqZ6hXA8HITjyuElY4NbFC1EDdRhIFdcR9huPm8OY54mt7biBlJ Tdmw== X-Gm-Message-State: AOAM5316k72MkNrmUX4AoYeaxvOd1+YkY4yrFz/11aL1Kve5ER3YsyHt NXE+8GH19jbtx+aItq8+hUa61kE8ICz+X+vUkSyeVw== X-Google-Smtp-Source: ABdhPJz7LBVE9G0FklzTLP3uMK+8ho+lPEAer2aH2x2P88+WwHOIvwpcKHpNBVp5M80nq++1xfgz3t4mbQjP3lzHp+s= 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" X-Rspamd-Queue-Id: DDC8018038E6C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000230, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > > > 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