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 B279AC54EE9 for ; Mon, 19 Sep 2022 12:59:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BD156B0073; Mon, 19 Sep 2022 08:59:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 145E580007; Mon, 19 Sep 2022 08:59:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F04206B0075; Mon, 19 Sep 2022 08:59:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D9A336B0073 for ; Mon, 19 Sep 2022 08:59:10 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A9D57140160 for ; Mon, 19 Sep 2022 12:59:10 +0000 (UTC) X-FDA: 79928840460.29.6BEDDE1 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf11.hostedemail.com (Postfix) with ESMTP id 61AB64003D for ; Mon, 19 Sep 2022 12:59:10 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id f193so2489930pgc.0 for ; Mon, 19 Sep 2022 05:59:10 -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=DDCYS4OcpjpU8EvjrVupEwljv/BUwUXqw8m9y87B0YiotdcutVG+enXUa9QRp9y9z8 XnGnQ3f28SY9SEjhA50WRy3eKrDKSA8GzgmeDBoO1AeXJ2ZR61ZVxoHiErmDDYQC5UIG +xfLXUMihzO8dCDnekL4P6h93Sx6GtGUxh7l/6yOxxI8mkBD7Wn7wULC9LTdFxAcroTZ BWXT7HhGoN2tziGA0inw5+33AuwF4+0up6hvn71X/fYJTQ1RsmwPoFFYn0IMCqhNdMrl iT368/XdkaGDCZkwP0u5KKpl8jYHQ9UpxfTSNHFttT4tzzHQKCmpdytWwOU7xlTMdz4x vR5A== X-Gm-Message-State: ACrzQf0Z8UHYtHKi/Wxjh2T7QJEzsNi7g7jI5oIoWpp1uXGN30ddjEWz Usokqq596mVytdcVjBWo341fZIuOSt8= X-Google-Smtp-Source: AMsMyM6gClp1WpJ2wREiuYk1/TuSNNXVpItw6DhT52ypFLSfHeWk91C0yfmoMho+tP0I13bH9z+IMQ== 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> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663592350; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zQfDWI1igyb60y77p+jlrfSAaSINkE3aQ82qQHnkWJw=; b=uZ9Mh/fZrNG69/j9XCrVmk6Nx43oLtb4B2W0yq1AZS3BrI9eGdtTseco7FXTfxTtqWtr8b nUT3sRjoiHGT14HHXpmV4Yem3s26ymSF+SGIkFrvhvqD8uQGSRwQwbtNo1UcZTqjfO0EkM a36HKRHqnuloofRBhZi9di1+hvakVIw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NfN2cN6z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663592350; a=rsa-sha256; cv=none; b=74j1/iR6+A/AZvQv+xeOWW4q3Oz73dY7yzhZvHY5A2G+6hjWlQR6Jp1yGgpNsCBmX8Xd45 EqmwJoInrpz7SAfrJyNn5qg/CAGpxxcGZnHAm5zOC57VLIc/5faXWU+4PKsNp57kiFc08j cNwc8j8vgHPoHT4siWsWriDaz/rMX7w= Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NfN2cN6z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com X-Rspam-User: X-Stat-Signature: eifqbmhataazjo96ytzfpq1g9bria9ka X-Rspamd-Queue-Id: 61AB64003D X-Rspamd-Server: rspam12 X-HE-Tag: 1663592350-854967 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, 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 :)