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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A617CC433E0 for ; Fri, 12 Jun 2020 11:56:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78C2B20801 for ; Fri, 12 Jun 2020 11:56:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u8WG4P2+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78C2B20801 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mo6EpFw8SiC2QNu9ujJOgLyx+ymwdK/b+obdawdluBA=; b=u8WG4P2+jtfyY1 x3QcS76vgWUYKExnskBjkRqltc4D4lZB1BAtev4MQsDtfoyx+lf+xdFqoU2gvnrURmJO54eO8qu7C KHM1/7LAhg2ISCcLRALSbG+2IHzZuPR0fi5wMil6u0bz/KVJVQ5I0ebrrEenhnWA/VDCgzM1SLQGZ rCTUY3gUQtztWwcDVHsbe7cozYJi27SE0MvAHQwct9kNCTDoDmN3oqdwO+EHAx7hj4wakK5xetVJ1 i2fvduEzccxal6Y55RpFhb3x2T/nMN7tHtvOVAaFvMvC0Em3hPqIuax97t75Opn9jJfjlKH+jRp6t SYpP23Lhqc3GWjS9qYwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjiIa-0006pv-SE; Fri, 12 Jun 2020 11:56:40 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjiIY-0006pa-1Y for linux-arm-kernel@lists.infradead.org; Fri, 12 Jun 2020 11:56:39 +0000 X-Originating-IP: 91.175.115.186 Received: from localhost (91-175-115-186.subs.proxad.net [91.175.115.186]) (Authenticated sender: gregory.clement@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 0D6DC240004; Fri, 12 Jun 2020 11:56:34 +0000 (UTC) From: Gregory CLEMENT To: Arnd Bergmann Subject: Re: [PATCH v2 4/6] ARM: mm: Aligned pte allocation to one page In-Reply-To: References: <20200611134914.765827-1-gregory.clement@bootlin.com> <20200611134914.765827-5-gregory.clement@bootlin.com> Date: Fri, 12 Jun 2020 13:56:34 +0200 Message-ID: <877dwc8pl9.fsf@FE-laptop> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200612_045638_219736_60D3A992 X-CRM114-Status: UNSURE ( 9.24 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Russell King , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Arnd Bergmann writes: > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > wrote: >> >> In pte_offset_kernel() the pte_index macro is used. This macro makes >> the assumption that the address is aligned to a page size. >> >> In arm_pte_allocation, the size allocated is the size needed for 512 >> entries. Actually this size was calculated to fit in a 4K page. When >> using larger page, the size of the table allocated is no more >> aligned which end to give a wrong physical address. >> >> The solution is to round up the allocation to a page size instead of >> the exact size of the tables (which is 4KB). It allows to comply with >> the assumption of pte_index() but the drawback is a waste of memory >> for the early allocation if page size is bigger than 4KB. > > Have you considered increasing PTRS_PER_PTE instead to fill up > a logical page instead? If that doesn't work, can you explain here > why not? Actually for this situation I didn't try to do better but it is only used very early during the boot. Then I'm expecting that the allocation is done though slab so with object at the exact size we need. However you also pointed modifying PTRS_PER_PTE for the overall memory consumption in the cover letter and in this case, it could worth modifying it. Gregory > > Arnd -- Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel