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=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A8588C433DF for ; Mon, 29 Jun 2020 22:13:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B202206E2 for ; Mon, 29 Jun 2020 22:13:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="TYDM21jl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B202206E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD2B36B00B1; Mon, 29 Jun 2020 18:13:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C82EA6B00B2; Mon, 29 Jun 2020 18:13:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B99876B00B3; Mon, 29 Jun 2020 18:13:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id A35456B00B1 for ; Mon, 29 Jun 2020 18:13:40 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 16F191EE6 for ; Mon, 29 Jun 2020 22:13:40 +0000 (UTC) X-FDA: 76983652200.14.grip73_080666726e72 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id C9E9A18229818 for ; Mon, 29 Jun 2020 22:13:39 +0000 (UTC) X-HE-Tag: grip73_080666726e72 X-Filterd-Recvd-Size: 5729 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 29 Jun 2020 22:13:38 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id dm19so8097764edb.13 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=A6Dqfd8NqHUVhUC78YlNd59cEQRiYysV1fRiWAmLzF49mXXsjZHNOO9uAkH7/66IW0 M30IxYNw58OMrrodR5BqwXrPjIra4iJyYHwAefSF/046Z5cPGFDxXs7WfnntbdqhXPtD CGUlV2wQjOmSYLSrsVISd7Y075UE00aFtdubTfkYhcj+iIKUqdNZP1/j1/G69R5rka/i 1Ooe48RoktC14dzqs+3HGPkJAYtivgEbc18/Rtenx2YxsGoWlExadUqEl4zIRwrXWlst L0rkx2ezpOUKHAgv8NwR3r7rDqfk7bCZ836/TlyqV6KF6/fV5t3QxjKFnjTSHhyttiPQ f4HQ== X-Gm-Message-State: AOAM533g1VSlsqJIu/mCtdZQhALOB6sT1OzAkFbnN0BFYCjcTq0icbA0 1NikDD9NaIwGAOlCTlUs2z12m5urznd+KONyjXM4xg== X-Google-Smtp-Source: ABdhPJxE92Vl3dMU6YdSUcgNvBLlsmv8x89spCVSrKlAXXuf4yBVYS/6NJ5lEkK2x5KqYdKSrSEwowTp1Kf9Tzq/l6Q= 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 X-Rspamd-Queue-Id: C9E9A18229818 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.