Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3990583pxb; Tue, 25 Jan 2022 00:51:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpePmiJ+33ct2Fwvyp3LQN18CiFlpnoSFaeuJ6WMS23XwlqG+XcKPf7vXbKrH0rqI2I/wR X-Received: by 2002:a17:906:5042:: with SMTP id e2mr16043518ejk.647.1643100668206; Tue, 25 Jan 2022 00:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643100668; cv=none; d=google.com; s=arc-20160816; b=MA9SUO+jToucywQLgz56VTg6wKBCAmAWYMjJD6f16paZhT/ctmxLZk2e0CMPaxjOHe T7BS/4u53juTo9qyrk9fkS5ysjV4HDER3Pme+V3F1tbfLBB/TvDA2wPNsAXIsg4e+4Da wHg+lXOOLwBrR8nWjuxFXQ9VqTAQ2mm30lceeDNurzRa6Ev63tWs0NDY55EUOlltbPN3 dQrZwT8H6IIoJIxwV3STaPnPiZqj4drd0j3G6WR/Ejieu7pHn10CO9YDu1SWs4zltUoT t80WrmNBnKZglQQ3TvoGypsKSOvUa2TjNS/FzYWz5aX1RwuBtUqgDhlYU4fJPQQPi+o6 bGuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=JGwAG6/K6eqI4ROP11oN6njq1BO8cXo10ivrjJT1IhM=; b=uQnGFh2CgwRH0O8tbzeootSBJ9XXUGrqXfrR+wDhAMknZFU1DW2JP9/x94c2vK3SDL 5If6TOMaYW2X9tbWEkMWkGQ8osfCEW+J8i58Naz+3H0plZomVCAqIkl88eq/ydi79AaK KEd7TxDVlZ/Sv7Q43pv3hSd9zZxWjZ2SKYPkWf5bpisc3pp+XBHPeDLkO5n8ZXNehKFv TIqKiNhjC4xP3lBQ8t7XbXHb8+D9gRQqQaeWmb7AHC3T0+w9s5PEditDvmk+Nyh4HeSO 6WFic0oPjKPtCnRkZdtdmxGcMEzHQ5rWBjo2DfjzlwGxr3dal33tq40aT0h2XFm2uAnO TY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=R64AiEWF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cr17si9752424ejc.951.2022.01.25.00.50.43; Tue, 25 Jan 2022 00:51:08 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=R64AiEWF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377976AbiAYDY0 (ORCPT + 99 others); Mon, 24 Jan 2022 22:24:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1320491AbiAYDNG (ORCPT ); Mon, 24 Jan 2022 22:13:06 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05BF8C08ED72 for ; Mon, 24 Jan 2022 14:55:34 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id p15so25642039ejc.7 for ; Mon, 24 Jan 2022 14:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JGwAG6/K6eqI4ROP11oN6njq1BO8cXo10ivrjJT1IhM=; b=R64AiEWFknCntog0tZC18TGnXiB1y5Y2xTuz/CmG0WEAEb8hm8E6OlvEkEIPAOdJM3 Bw1nSqPs7QKx8RD3sME4v6zItGSmxO4aG+bc0TJ474BByBNnA3i75lKemIZ7eTHIH/9P oZosPYguHpX9tOo2yjIxcD2llPd6b4Mi0apoAIK6cldMPfGZclgoI/+Uu1AB+Asx6XOP CgPwk83bL4hgyCPvU7M9BDluwiY8S6nB/TEbnfiXsKCBFinTJT0ra/2h4oQBU6vzKxwi EwUqjMguq+7vNWTqvpv2kfnT2jewJMe0T4zg6ppg47t5uHQiinAR0t3t6KP11NOYRRXs Fvfg== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=JGwAG6/K6eqI4ROP11oN6njq1BO8cXo10ivrjJT1IhM=; b=1eeeFIIOu8Jo75aRoYBMXEQXLlfArDCFRxrSrrq21yxI0bvXg/TDgLDVjjayRqzrIt DTGr03nGloh3bdqRbYFgayrbhIRlw5YbdjXfTLYBw+Guf2+QTBF2br8cLr7jAQW/JFyT n1alQclhs/bnA77FYd5NAgf0NEEJF/Onr5dBcZjJ9zzytKyByk3FDMAxQDuuCNKlLrip F/tovq1b3c2xMrmpxt8NF/U0r/neAcwb0eL1gFFYg8y8kM56l632DwTVYawkv4WOF4Xp pZYUQVaYlIy6q95Ek9g3CgA1m81OmVin3YzRE0Hz3B2cyYkHGGa4lUfDyJtY/D/OAirG AoxQ== X-Gm-Message-State: AOAM531qniywMFQO7a6sPZFB7C9xtAokKO2OP8qgLBueMhrEoOC0EK/g WreXpsXnABBa1tk1NaktptY= X-Received: by 2002:a17:907:d1a:: with SMTP id gn26mr1946334ejc.53.1643064932433; Mon, 24 Jan 2022 14:55:32 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id d6sm5045772eds.25.2022.01.24.14.55.31 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jan 2022 14:55:31 -0800 (PST) Date: Mon, 24 Jan 2022 22:55:31 +0000 From: Wei Yang To: Vlastimil Babka Cc: Wei Yang , Matthew Wilcox , Andrew Morton , peterz@infradead.org, will@kernel.org, linyunsheng@huawei.com, aarcange@redhat.com, feng.tang@intel.com, ebiederm@xmission.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: remove offset check on page->compound_head and folio->lru Message-ID: <20220124225531.26yyse52yo5x3fr5@master> Reply-To: Wei Yang References: <20220106235254.19190-1-richard.weiyang@gmail.com> <20220107134059.flxr2hcd6ilb6vt7@master> <20220107160825.13c71fdd871d7d5611d116b9@linux-foundation.org> <20220108081340.3oi2z2rm3cbqozzt@master> <20220123013852.mm7eyn3z26v3hkc2@master> <93c48e68-2266-72ee-0763-65805b94c968@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93c48e68-2266-72ee-0763-65805b94c968@suse.cz> User-Agent: NeoMutt/20170113 (1.7.2) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 11:30:10AM +0100, Vlastimil Babka wrote: >On 1/23/22 02:38, Wei Yang wrote: >> On Sat, Jan 08, 2022 at 08:13:40AM +0000, Wei Yang wrote: >>>On Sat, Jan 08, 2022 at 12:49:53AM +0000, Matthew Wilcox wrote: >>>>On Fri, Jan 07, 2022 at 04:08:25PM -0800, Andrew Morton wrote: >>>>> On Fri, 7 Jan 2022 22:11:20 +0000 Matthew Wilcox wrote: >>>>> >>>>> > > Hi, Matthew >>>>> > > >>>>> > > Would you mind sharing some insight on this check? >>>>> > >>>>> > It's right there in the comments. >>>>> >>>>> Well I can't figure out which comment you're referring to? >>>> >>>> * WARNING: bit 0 of the first word is used for PageTail(). That >>>> * means the other users of this union MUST NOT use the bit to >>>> * avoid collision and false-positive PageTail(). >>>> >>> >>>I know this requirement on bit 0 of first word. But I don't see the connection >>>between this and the check of page->compound_head and folio->lru. >>> >>>This is more like a internal requirement on struct page. There are 8 struct in >>>this five words union. And this requirement apply to bit 0 of first word of >>>all those five struct. >>> >>>To me, if folio has the same layout of page, folio meets this requirement. I >>>still not catch the point why we need this check here. >>> >> >> Hi, Matthew >> >> Are you back from vocation? If you could give more insight on this check, I >> would be appreciated. > >I can offer my insight (which might be of course wrong). Ideally one day >page.lru will be gone and only folio will be used for LRU pages. Then there >won't be a FOLIO_MATCH(lru, lru); and FOLIO_MATCH(compound_head, lru); >won't appear to be redundant anymore. lru is list_head so two pointers and Thanks for your comment. I can't imagine the final result. If we would remove page.lru, we could remove FOLIO_MATCH(lru, lru) and add FOLIO_MATCH(compound_head, lru) at that moment? >thus valid pointers are aligned in such a way they can't accidentaly set the >bit 0. > -- Wei Yang Help you, Help me