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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91FB8C433EF for ; Wed, 13 Apr 2022 11:38:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 167CA6B0072; Wed, 13 Apr 2022 07:38:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 117FD6B0073; Wed, 13 Apr 2022 07:38:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF98E6B0074; Wed, 13 Apr 2022 07:38:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id E02486B0072 for ; Wed, 13 Apr 2022 07:38:30 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 67B2A183E3985 for ; Wed, 13 Apr 2022 11:38:30 +0000 (UTC) X-FDA: 79351657980.27.63860AE Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf22.hostedemail.com (Postfix) with ESMTP id EE767C0005 for ; Wed, 13 Apr 2022 11:38:29 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id k5so2966099lfg.9 for ; Wed, 13 Apr 2022 04:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZsUJ2NINlf/YGW3oKuUtDCOd4WHYH6lv9r94E8nLe7k=; b=uxdU90BlQLxm0jDBpwT7ZMBvjlYIIiuIeQRT3hGbatcT1HUweuug/AHiWZ/ufhqwGo mVAjin2rGuacjH0++numKLzwazoDwfSff0NMvZVnuAPgoMJbqvDy1edfuAy40M8BFC/x a3laDOVAcLJR3IqFtnn+Amrp1MEceVLZ4500Kf78sVczEg4lQrTkzpiTM7sGu7TF/IL1 MrG+dTFhVE/Z0ag7oNkra0VOAz8vP+9DIsrR7yV5mXS7nXj3rXbXcUt96Tg/WxcJ5oe7 D66RiJa98VTqhO3o+k7IwlPhz5/uW8Mzr89bUA/hjNBYKp6JqGfad4ttcKn8J102HYgP mZKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZsUJ2NINlf/YGW3oKuUtDCOd4WHYH6lv9r94E8nLe7k=; b=1sLvS8vwRgL1RlmrDiIifvGpGdzRPR+dlKBDHc37YVOgO9wa0rbcoGNuqrf/qXpjTR ttQ1n/K92YDimULIVVLLaGECozo4CzVuodydMcK/7cNAqCskrPtJ2vZ3hDaUaUO6EjyW QXselGJ3y0sAOyKcMULAHi5ULxz5KAh6VTa5717ZswfUL3V8yM/QD7jFzzJnWEpAYzpx mxNArAxZMogUIm38uGoyGv0RbnZicYyUeFe+7EZcDlQu8DHFbEn/7jmUqsK3lpka8Ufs 7FwTG4b/jvnFNLdAlDdZ1Qv9uAe9ZhCI8d0WKKHnw/eM35in701Pjl2BRBEUqS3VVC/Z s8Yw== X-Gm-Message-State: AOAM533FVYbzTy78Tzd3dt5p9W9CvUH+F/E19OvnVyE0tNry/kVF8g0H j84bpjZjAtrmu0BYnft/N42OrA== X-Google-Smtp-Source: ABdhPJyqOiwPXY3JcLiTivxhds7PtI4vfS0IEt8zlViK9HOGTpUtfBt/VR8j//JV+OX1VzpzOxSuGQ== X-Received: by 2002:a19:4953:0:b0:46b:bdc2:860a with SMTP id l19-20020a194953000000b0046bbdc2860amr4567387lfj.6.1649849908414; Wed, 13 Apr 2022 04:38:28 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id k5-20020a196f05000000b0046b94269595sm1503056lfc.169.2022.04.13.04.38.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Apr 2022 04:38:28 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id DF1E510369B; Wed, 13 Apr 2022 14:40:01 +0300 (+03) Date: Wed, 13 Apr 2022 14:40:01 +0300 From: "Kirill A. Shutemov" To: Mike Rapoport Cc: Dave Hansen , "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Brijesh Singh , David Hildenbrand , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: Re: [PATCHv4 1/8] mm: Add support for unaccepted memory Message-ID: <20220413114001.wdsi2xrm4btrghms@box.shutemov.name> References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> <20220405234343.74045-2-kirill.shutemov@linux.intel.com> <767c2100-c171-1fd3-6a92-0af2e4bf3067@intel.com> <20220409155423.iv2arckmvavvpegt@box.shutemov.name> <6c976344-fdd6-95cd-2cb0-b0e817bf0392@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: rkebptmw7fej957kpsdjkcjmqcka9yxk X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EE767C0005 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=shutemov-name.20210112.gappssmtp.com header.s=20210112 header.b=uxdU90Bl; dmarc=none; spf=none (imf22.hostedemail.com: domain of kirill@shutemov.name has no SPF policy when checking 209.85.167.52) smtp.mailfrom=kirill@shutemov.name X-Rspam-User: X-HE-Tag: 1649849909-428144 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, Apr 11, 2022 at 01:07:29PM +0300, Mike Rapoport wrote: > On Sun, Apr 10, 2022 at 11:38:08PM -0700, Dave Hansen wrote: > > On 4/9/22 08:54, Kirill A. Shutemov wrote: > > > On Fri, Apr 08, 2022 at 11:55:43AM -0700, Dave Hansen wrote: > > > > >>> if (fpi_flags & FPI_TO_TAIL) > > >>> to_tail = true; > > >>> else if (is_shuffle_order(order)) > > >>> @@ -1149,7 +1192,8 @@ static inline void __free_one_page(struct page *page, > > >>> static inline bool page_expected_state(struct page *page, > > >>> unsigned long check_flags) > > >>> { > > >>> - if (unlikely(atomic_read(&page->_mapcount) != -1)) > > >>> + if (unlikely(atomic_read(&page->_mapcount) != -1) && > > >>> + !PageUnaccepted(page)) > > >>> return false; > > >> > > >> That probably deserves a comment, and maybe its own if() statement. > > > > > > Own if does not work. PageUnaccepted() is encoded in _mapcount. > > > > > > What about this: > > > > > > /* > > > * page->_mapcount is expected to be -1. > > > * > > > * There is an exception for PageUnaccepted(). The page type can be set > > > * for pages on free list. Page types are encoded in _mapcount. > > > * > > > * PageUnaccepted() will get cleared in post_alloc_hook(). > > > */ > > > if (unlikely((atomic_read(&page->_mapcount) | PG_unaccepted) != -1)) > > Maybe I'm missing something, but isn't this true for any PageType? > > > > return false; > > > > > > ? > > > > That's better. But, aren't the PG_* names usually reserved for real > > page->flags bits? That naming might be part of my confusion. > > We use them for PageType as well like PG_buddy, PG_offline, PG_Table. PG_buddy gets clear on remove from the free list, before the chec. PG_offline and PG_table pages are never on free lists. -- Kirill A. Shutemov