Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3095297ybt; Mon, 29 Jun 2020 15:14:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWMZdJFrYOPmAPoo2bcsndRK9d7J7N5rx38B++FGoJeyu2sGKYRK8msdjNH0/XPwJjsUVJ X-Received: by 2002:a17:906:4a45:: with SMTP id a5mr15364019ejv.384.1593468851552; Mon, 29 Jun 2020 15:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593468851; cv=none; d=google.com; s=arc-20160816; b=D/oegFc0V7/oO28D7qM5RlMm6f997FGr4uvs3DLFsyYhCud9Q5aUlJqNbJOmzh4PnJ K9QJc7eXwYB+MbpKIbkiuhsLvfpyL5yqwg1qmg0k35NMhxvjajFdewDoBjTPQZiEM11q 9eSoZUF9/GNp1w2JA3Hz2LToJ4ieDqZcdHFMkUz8REXljpFJUQ5wGUp31qjVFtuKXUbb 1bpj+V7ZRLu6YYEuCFPjHQIuY/vKidBMw2wIsmpVXoczDEeTD102b1tcT7QKcSyHb5lA GkRPldbctkgVkS5tMqROGhZS5WKOA+EG8HPVrkRa1ZGOgbOnE7FgWP3Kv45KBbT2TGCX jehQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=K4P8LKVTe5uXiv5CF12dyUP3GsCS0f55L5RS9bYmy6s=; b=RAtE/Ix91w5yG8EST3pfpRTPUWeNcQ3/1ziBkti7tW9dqKWqjlQK33d5wY2gokTdAW nlkJylVaEZPQrTVvbJnpr3xBPbvuYAh+LCy4dGNQQnLndgsaVJQ6DiIJo9bSM7k98Bdd ZxMlAFRMhwKVCcea3sQDmg+eWkBVCJQAqa6o8yeoVHfcgVudgtEocc9f1CIeVu6Pcndo 8rcVOAbj7d4NiVsfCGCItcXcDp2MD7dXKRBPzU3jo7GbXLTewAAlp5evkvEXvVW66W5e qnaLYk2OwXZGYEE4SE9j1rsXBAUscqMTDBdKFJyME/tjNvTG95hjCP1BIKOpwH/E+r1c uyoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=TYDM21jl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si525025ejs.158.2020.06.29.15.13.48; Mon, 29 Jun 2020 15:14:11 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=TYDM21jl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbgF2WNj (ORCPT + 99 others); Mon, 29 Jun 2020 18:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgF2WNi (ORCPT ); Mon, 29 Jun 2020 18:13:38 -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 CBED4C061755 for ; Mon, 29 Jun 2020 15:13:37 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id b15so14352698edy.7 for ; Mon, 29 Jun 2020 15:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=K4P8LKVTe5uXiv5CF12dyUP3GsCS0f55L5RS9bYmy6s=; b=TYDM21jlaEWrczTgpptgS/N7rK1Bd/hFjHiVqFg8CH/odj/0JHq/SWjjosVXKTar0z JhK0lqHlowbBubO5YdLsUIeYZqoAIAx41jaVKt4jSZpb9qpKbMBklKkP+qPBJVhuzJ/8 tvmvypxaw478c7pUQG3gCWp0B00HOvTU6J95+KtSNLm6Q/LEHfvPMfe+VpX9RiSXZYAb +BpANty5cTk/d/KSm1hi4dJ4MQ/01iP79D9O3qM3TdiboMmxEhtFQkndMeJiyPaI6TGC w1OmACGfeq4MdZD1B3EC1+N0XkJeGk3RNigxpW5ThA5OGMicYBnEvh9GttgQI6kck035 ZZYQ== 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:content-transfer-encoding; bh=K4P8LKVTe5uXiv5CF12dyUP3GsCS0f55L5RS9bYmy6s=; b=ITTMg6dc7UTdj0wj0eV6ym5PxpMoQ6v4CQFchXcxurO+CYtl7GOxESF17NUg2trc7K j20PEH5m625KAuw+NdNCBOmARqjZRuGrjH2KtKZ1pXJwfiDOjfx14iSqblYvFmxJ3rFq 4xa8HfjYxmSHDYbUoFuRsZpH8YPMNipzXFsY4H3xvoThafO48M9sHPEInxxtCqswnEm6 PWdwlC8wMILk9RpJqsdTXOjRfMfUp6967XilJPRQU3MpzVe55dCCfPtpqflH+hnPwa6Q yg6kwhYZhSvZLuErqDzw0Yb3sFoWVOwCuXUgJTAC+yeOXiCeRBs/V3HjNlB+q+TqG8Dl VN/g== X-Gm-Message-State: AOAM533H6yIOA28IZyEy4X02jqO1D32nD4JM8CiKrMVENYJG3sqzSp2I Ef/idcXdhXvCJeHD6V5161vTED1dOhdTx5ewrVniAg== X-Received: by 2002:aa7:c24d:: with SMTP id y13mr20776220edo.123.1593468816606; Mon, 29 Jun 2020 15:13:36 -0700 (PDT) MIME-Version: 1.0 References: <4D73CD59-BFD5-401A-A001-41F7BF5641BA@redhat.com> <20200629083411.GA38188@L-31X9LVDL-1304.local> In-Reply-To: <20200629083411.GA38188@L-31X9LVDL-1304.local> From: Dan Williams Date: Mon, 29 Jun 2020 15:13:25 -0700 Message-ID: Subject: Re: [PATCH] mm/spase: never partially remove memmap for early section To: Wei Yang Cc: David Hildenbrand , Michal Hocko , Andrew Morton , Oscar Salvador , Linux MM , Baoquan He , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 29, 2020 at 1:34 AM Wei Yang wrote: > > On Thu, Jun 25, 2020 at 12:46:43PM -0700, Dan Williams wrote: > >On Wed, Jun 24, 2020 at 10:53 PM David Hildenbrand wr= ote: > >> > >> > >> > >> > Am 25.06.2020 um 01:47 schrieb Dan Williams : > >> > > >> > =EF=BB=BFOn Wed, Jun 24, 2020 at 3:44 PM Wei Yang > >> > wrote: > >> > [..] > >> >>> So, you are right that there is a mismatch here, but I think the > >> >>> comprehensive fix is to allow early sections to be partially > >> >>> depopulated/repopulated rather than have section_activate() and > >> >>> section_deacticate() special case early sections. The special casi= ng > >> >>> is problematic in retrospect as section_deactivate() can't be > >> >>> maintained without understand special rules in section_activate(). > >> >> > >> >> Hmm... This means we need to adjust pfn_valid() too, which always r= eturn true > >> >> for early sections. > >> > > >> > Right, rather than carry workarounds in 3 locations, and the bug tha= t > >> > has resulted from then getting out of sync, just teach early section > >> > mapping to allow for the subsection populate/depopulate. > >> > > >> > >> I prefer the easy fix first - IOW what we Here here. Especially, pfn_t= o_online_page() will need changes as well. > > > >Agree, yes, let's do the simple fix first for 5.8 and the special-case > >elimination work later. > > Dan, > > A quick test shows this is not a simple task. Thanks for taking a look... > First, early sections don't set subsection bitmap, which is necessary for= the > hot-add/remove. > > To properly set subsection bitmap, we need to know how many subsections i= n > early section. While current code doesn't has a alignment requirement for > last early section. We mark the whole last early section as present. I was thinking that the subsection map does not need to be accurate on initial setup, it only needs to be accurate after the first removal. However, that would result in new special casing that somewhat defeats the purpose. The hardest part is potentially breaking up a PMD mapping of the page array into a series of PTE mappings without disturbing in-flight pfn_to_page() users. > I don't find a way to enable this. While I don't like that this bug crept into the mismatched special casing of early sections, I'm now coming around to the same opinion. I.e. that making the memmap for early sections permanent is a simpler mechanism to maintain.