Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2576414rwb; Mon, 19 Sep 2022 07:06:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5z9k5QeExwomXqGJcAW90H4qBLiRGakkA463VBYzGQQzPoh7jfrrFXWa5CIxm7LZKX8eKo X-Received: by 2002:a17:906:8a5a:b0:781:6a01:5ccc with SMTP id gx26-20020a1709068a5a00b007816a015cccmr2280701ejc.118.1663596370405; Mon, 19 Sep 2022 07:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663596370; cv=none; d=google.com; s=arc-20160816; b=tIhSznjqSulOqEhFzeNIo+4MwWKlvCOBwj9yB1n3kYQ2+pv2zZDyW0SaT2Pytii2sx NVweBXjuY82iHrTw3fGNx39U2Q2RRikD9evCiaBSYL3Uwd5z4+HEPV+LNP4+Fnb4GvUM ENsVfzNiHUFb3P/1hYKaiG04lfjH5tB4jZZitK+SjxDXoN7FwqFidDcU/oflHanfEppf Wnkrm9+q3lAMsiwx9ZbnIFRNzgQrQZHH/oXRA+3OowlUJkH5qWO0vZ91k70WFn/Q62DL nxiP2cO320K+6pyhJQgqEFY+WK+VRw6nPCMdvfrvEhQbP5DU7w4kPmu2onuf7fYURgel CZxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zQfDWI1igyb60y77p+jlrfSAaSINkE3aQ82qQHnkWJw=; b=B5yI0o1MYcKlxPdeeDBr7oJzOT7Tm4s9vCq9czQNOnI90yRCMz00RMtOjgskYPsJ2k v9XO0iCPSz+iYopxk9qx2yr+CRggdTjak4aYm88O0pjhMOWSFbV638A2CpEcVvcnsF+d A76T9nDkh03jzU3UP284E4pwlSGj1PKTAdk+q/RzyVj8cCsM3fD7bH/4YHnjGi+eMjFJ 6VcaQZGK/2H5nuSAvjPVwG+Lifro+n0ckwyXApewRVb2cY7TUIbXaLUocw+mdi405Z0N Hvkl66iELSWPvr2cg08oeQcG/8ljqFykGMOlh1hTgldBrBFWruNYPdN1p767x5I8y0mU 87WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NfN2cN6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa11-20020a1709076d0b00b007413f3f0acbsi15360546ejc.357.2022.09.19.07.05.44; Mon, 19 Sep 2022 07:06:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NfN2cN6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbiISM7O (ORCPT + 99 others); Mon, 19 Sep 2022 08:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiISM7J (ORCPT ); Mon, 19 Sep 2022 08:59:09 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 384CB20F77 for ; Mon, 19 Sep 2022 05:59:09 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id l65so27987421pfl.8 for ; Mon, 19 Sep 2022 05:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=zQfDWI1igyb60y77p+jlrfSAaSINkE3aQ82qQHnkWJw=; b=NfN2cN6zcQbs0Cod7IguKf68/HnL0b1H6aLswTrPbve4XL1uiXf+R4jBP9tvBMGG0F Ju28dyfy6gc8DCIRHVJqNsxID2WpH5tCa/mD3swMVtylKH0Q7VnIWMNqxByrxdvtzrPW qSA5k/jdHmE9miOqxGxo6BQ1YaMGseuYkgHnSXjozBCDvvOmuvTDTgU6H93a+kQxAmeA Vu5ApXtBzew6nb8DIM5haw/+dHIfk03w94YquuVD7GlSqa7UPIsDw0TDzGxmcpiJChrj 3eI4Zl1E5VxL3JzB6NnApYxgpSc1Fg/6iTKgJ5yTtaYNhbn7je6w3fn54MX/X40OhTar OY6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=zQfDWI1igyb60y77p+jlrfSAaSINkE3aQ82qQHnkWJw=; b=BtyhsakB+52f6eM871B5xhzWgmxd0undpLOQxr9TkZpFJevSnuIz/nPljaOFNG6h1s hba7XuZTU38h4fiGSJqfUahc8Ee/uIDMGLRcYuMf/JZxnOsGeAH4ceV0EToGqGaGj/IM GYpgiMnat+BZBJD3Ps5DrPvWf/EM2C39zm8h+Qzi7HiDjc4hzhdWWDWQlOTJtGObeR0+ ry2lMBt9oVjnjnAuA6Yr5co5PSMrBiGHafq94Pp+wYcVn8lvuYZb0hTST9mITHZUrWJ4 pmlRs8voNCYh0nPsU1B2FIRSCEa/EoyawlU9ik33bvqjATaafMNu2lsg2wXPHZDtmfC3 RHgA== X-Gm-Message-State: ACrzQf1uERWSjbowojEEelwZhU6atixpHXHpi2J5v17O7FE9sLmFnw87 9FYu/hczWu5V4ud56yU2Rwg= X-Received: by 2002:a05:6a00:140d:b0:52a:d561:d991 with SMTP id l13-20020a056a00140d00b0052ad561d991mr18431245pfu.46.1663592348613; Mon, 19 Sep 2022 05:59:08 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id n10-20020a170903404a00b00172d9f6e22bsm20267744pla.15.2022.09.19.05.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 05:59:08 -0700 (PDT) Date: Mon, 19 Sep 2022 21:59:00 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Naoya Horiguchi , Miaohe Lin , "Matthew Wilcox (Oracle)" , Minchan Kim , Mel Gorman , Andrea Arcangeli , Dan Williams , Hugh Dickins , Muchun Song , David Hildenbrand , Andrey Konovalov , Marco Elver Subject: Re: [RFC PATCH] mm: move PG_slab flag to page_type Message-ID: References: <20220919125708.276864-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919125708.276864-1-42.hyeyoo@gmail.com> X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 19, 2022 at 09:57:08PM +0900, Hyeonggon Yoo wrote: > For now, only SLAB uses _mapcount field as a number of active objects in > a slab, and other slab allocators do not use it. As 16 bits are enough > for that, use remaining 16 bits of _mapcount as page_type even when > SLAB is used. And then move PG_slab flag to page_type! > > Note that page_type is always placed in upper 16 bits of _mapcount to > avoid confusing normal _mapcount as page_type. As underflow (actually > I mean, yeah, overflow) is not a concern anymore, use more lower bits > except bit zero. > > Add more folio helpers for PAGE_TYPE_OPS() not to break existing > slab implementations. > > Remove PG_slab check from PAGE_FLAGS_CHECK_AT_FREE. buddy will still > check if _mapcount is properly set at free. > > Exclude PG_slab from hwpoison and show_page_flags() for now. > > Note that with this patch, page_mapped() and folio_mapped() always return > false for slab page. > > Cc: Andrew Morton > Cc: Christoph Lameter > Cc: Pekka Enberg > Cc: David Rientjes > Cc: Joonsoo Kim > Cc: Vlastimil Babka > Cc: Roman Gushchin > Cc: Naoya Horiguchi > Cc: Miaohe Lin > Cc: "Matthew Wilcox (Oracle)" > Cc: Minchan Kim > Cc: Mel Gorman > Cc: Andrea Arcangeli > Cc: Dan Williams > Cc: Hugh Dickins > Cc: Muchun Song > Cc: David Hildenbrand > Cc: Andrey Konovalov > Cc: Marco Elver > Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > --- > > I think this gives us two benefits: > - it frees a bit in flags field > - it makes it simpler to distinguish user-mapped pages and > not-user-mapped pages. > > Plus I'm writing a bit more of code including: > 0) a few cleanup for code that checks > !PageSlab() && page_mapped() or that does similar thing > 1) provide human-readale string of page_type in dump_page > 2) add show_page_types() for tracepoint > 3) fix hwpoison ...etc. > > Anyway This is an early RFC, I will very appreciate feedbacks! Looks like I forgot to add RFC in subject :)