Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2518809ybb; Mon, 30 Mar 2020 07:43:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvO2u5ium38jhcoYDo0h7mWxIz68b4MKF/g7zYwbEWimWswE9gdVgnoLh0x7VUKxCcJ4o+o X-Received: by 2002:aca:7512:: with SMTP id q18mr7759308oic.71.1585579390911; Mon, 30 Mar 2020 07:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585579390; cv=none; d=google.com; s=arc-20160816; b=KSjmC7A/2aOzq0WMb2QXH2BXth3LJe3t9bUpSaZt+dLgDTXTnQ9qP93i1tJA+39+AR inW/tKsoD/NdzNyVL3XFLP0WYBfW/mJ+fIc/pu3WaMRhiB0+MKYoYGQMessavZ6CW79O +BO/JYeJQJ+uxfe3OPAFllDxATU+LGa1xzoioUrTK55dfwOkdkGOe86ubPk3X2n8xSnS 2lg4PRWdcFWU6A5JlsaetOGbJMET7IcRWbe/UrtzpgdhfUsQVeQIP4lJOPwSf8nmZ4rO ZrRSi+VyK0zX/6dbci1NufV6rI2tX529J2BLpw6SUp9WzeQI5RgONRIVGaJ1OgZnvdFi 77ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=G9G7LXUIUcwm5Tey2Anco7zNrOhYjJba/HCYfMtgmfc=; b=XBoPd392J4cfPiDormsLtVGYBzpDOtDxQK/EV6/svbM913Quq/YQAGWpXpaenQQ1ih ANV8f8GbSBP2aE4zdCNQub+RI8nW6ufD23TK5dgIEs+qrmyBhpssa0Al5LK8ZdXLO6p9 1YO7pzrsuya97/xfcdDQ9VKDMeUbJbMx2qM6iFn+XdZ1bhUOkp2qQXDbP9JgO5krw7ra BBIX3OJpg4d2VRG7GpqKHnv7HnOXPO/OCTfabetM3s5bF0LtQgdAJsxSYapjrdeBS7m/ CukIrKbsl/NXchxjdvbSWW5pGAAqymAJhW8I+ow4BJSf4WTbkkh1tosiQLfj7THsCIo8 w8jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EEG+NCB9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m22si5442364otn.81.2020.03.30.07.42.58; Mon, 30 Mar 2020 07:43:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EEG+NCB9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728317AbgC3O1I (ORCPT + 99 others); Mon, 30 Mar 2020 10:27:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:57714 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbgC3O1I (ORCPT ); Mon, 30 Mar 2020 10:27:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=G9G7LXUIUcwm5Tey2Anco7zNrOhYjJba/HCYfMtgmfc=; b=EEG+NCB9bf6g+bxztsQWuzwanK xx5hayOTfnSr5WqzSxaQyPxs5W6FIzqAaRqjU2qY1MX0nxl0uITm3idHvPctjkq5bjdF0EAUSg3y+ aUHdvE6Jvx3kN06bElUl0+Epxb9EMVeWDg2+lcBo+r6BbkFJbOra3KwuOgocEhCvTT9FTO6WoT2r7 UzPEDpRgL/Ky1MqpLl/IaIacTzisCgr7XDGU7XtFho1uKIWB1Sn5a2pyLvXmC2DIo5K6pOKh7YsUt +F74TXPhii9BUVEaJLFudRo0MGXUfVCdUns3dtK0epemyBVjW+WXn9t9f+5yQVpIgz462gQ3DcoxS sZ3k16Tg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jIvNc-0003i0-5J; Mon, 30 Mar 2020 14:27:08 +0000 Date: Mon, 30 Mar 2020 07:27:08 -0700 From: Matthew Wilcox To: Wei Yang Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/9] XArray: internal node is a xa_node when it is bigger than XA_ZERO_ENTRY Message-ID: <20200330142708.GC22483@bombadil.infradead.org> References: <20200330123643.17120-1-richard.weiyang@gmail.com> <20200330123643.17120-7-richard.weiyang@gmail.com> <20200330125006.GZ22483@bombadil.infradead.org> <20200330134519.ykdtqwqxjazqy3jm@master> <20200330134903.GB22483@bombadil.infradead.org> <20200330141350.ey77odenrbvixotb@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200330141350.ey77odenrbvixotb@master> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2020 at 02:13:50PM +0000, Wei Yang wrote: > On Mon, Mar 30, 2020 at 06:49:03AM -0700, Matthew Wilcox wrote: > >On Mon, Mar 30, 2020 at 01:45:19PM +0000, Wei Yang wrote: > >> On Mon, Mar 30, 2020 at 05:50:06AM -0700, Matthew Wilcox wrote: > >> >On Mon, Mar 30, 2020 at 12:36:40PM +0000, Wei Yang wrote: > >> >> As the comment mentioned, we reserved several ranges of internal node > >> >> for tree maintenance, 0-62, 256, 257. This means a node bigger than > >> >> XA_ZERO_ENTRY is a normal node. > >> >> > >> >> The checked on XA_ZERO_ENTRY seems to be more meaningful. > >> > > >> >257-1023 are also reserved, they just aren't used yet. XA_ZERO_ENTRY > >> >is not guaranteed to be the largest reserved entry. > >> > >> Then why we choose 4096? > > > >Because 4096 is the smallest page size supported by Linux, so we're > >guaranteed that anything less than 4096 is not a valid pointer. > > I found this in xarray.rst: > > Normal pointers may be stored in the XArray directly. They must be 4-byte > aligned, which is true for any pointer returned from kmalloc() and > alloc_page(). It isn't true for arbitrary user-space pointers, > nor for function pointers. You can store pointers to statically allocated > objects, as long as those objects have an alignment of at least 4. > > So the document here is not correct? Why do you say that? (it is slightly out of date; the XArray actually supports storing unaligned pointers now, but that's not relevant to this discussion)