Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2416259imu; Tue, 6 Nov 2018 14:17:22 -0800 (PST) X-Google-Smtp-Source: AJdET5eamu09lHoQMGWvZQx6rKjNIBUc6XudI5X9lNIOG6p9vebTBq9gUg5D9FiacsR1fDCM3HNR X-Received: by 2002:a62:30c7:: with SMTP id w190-v6mr27480987pfw.188.1541542642594; Tue, 06 Nov 2018 14:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541542642; cv=none; d=google.com; s=arc-20160816; b=bHZH2t+usEidht1TyyerQfXEG1D0dHW3nmrfCICpoLs2zjgTTpzakhQGn2SE8xAyvc zS5Hxsdz37e77xDTFEorxjTEB1/H43sWR2Ggt+jTo/9Ge8/jQadrnTfQv26VY+HxJ0cw pJ6tmdQL5jgmH38PsDQsp/9uONOM8dyzP6tIqFl+iuc1Ih0DGwicZuX94t3kPQj3ysqg kc0Jwh0V4Dg/2HNH5VdsALxy1ynHCc4NGMwaq2GA29YNwSX9jvvU0eIQA93cFjchoKeF tXGL3ee40b/xsGX8KhvrfS2kDSvA3vrVkWt9yCHOpPCCPTdAk7bWdHOEYJ62+z7OMMqi oopA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=rSzV1u9iGsN347j8E7yQZmvg/hCqOn84k5BKhRXkfs8=; b=UZ6lnS5+YAVV6u8TCQ/CizYgk7Ps++m+bnppzAUxT1Gz1ZLVefhXN1SuIGN6D2XwbS Hk6GIPknWlX7lR8IIcFUB1USiNRgUxrnPbOUMOjttCLHjzCDLdDZPA2YPdKcO0iktCqa EuKdRaz+Nv1hzU+icg+8fkkdbkrmuizT1zcu42RTn28RU/GggzD1TFqrxNFJRqeG4ujI kobcou34X/hS67MYRri5MTSX8+I0VPXj6t8bHJe/3y6OinI9Acte2OrFzr1XUQ0ruWvz KmU0uvNfvhTGRBesjdfd+xRj6n57w6fEJkxvGpBp86PuAXk7xQlxgiVGD2oavZ6pbss0 PTCw== ARC-Authentication-Results: i=1; mx.google.com; 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 cd11-v6si13336019plb.59.2018.11.06.14.17.07; Tue, 06 Nov 2018 14:17:22 -0800 (PST) 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; 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 S1730851AbeKGHnI (ORCPT + 99 others); Wed, 7 Nov 2018 02:43:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:57142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbeKGHnI (ORCPT ); Wed, 7 Nov 2018 02:43:08 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 78F4049F; Tue, 6 Nov 2018 22:15:43 +0000 (UTC) Date: Tue, 6 Nov 2018 14:15:42 -0800 From: Andrew Morton To: Alexey Skidanov Cc: sbates@raithlin.com, logang@deltatee.com, danielmentz@google.com, mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org, labbott@redhat.com Subject: Re: [PATCH] lib/genaloc: Fix allocation of aligned buffer from non-aligned chunk Message-Id: <20181106141542.08a9d7de30a439ec9fe50486@linux-foundation.org> In-Reply-To: <1541506853-10685-1-git-send-email-alexey.skidanov@intel.com> References: <1541506853-10685-1-git-send-email-alexey.skidanov@intel.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 6 Nov 2018 14:20:53 +0200 Alexey Skidanov wrote: > On success, gen_pool_first_fit_align() returns the bit number such that > chunk_start_addr + (bit << order) is properly aligned. On failure, > the bitmap size parameter is returned. > > When the chunk_start_addr isn't aligned properly, the > chunk_start_addr + (bit << order) isn't aligned too. > > To fix this, gen_pool_first_fit_align() takes into account > the chunk_start_addr alignment and returns the bit value such that > chunk_start_addr + (bit << order) is properly aligned > (exactly as it done in CMA). > > ... > > --- a/include/linux/genalloc.h > +++ b/include/linux/genalloc.h > > ... > > + struct gen_pool *pool, unsigned long start_add) > > ... > > + struct gen_pool *pool, unsigned long start_add) > > ... > > + struct gen_pool *pool, unsigned long start_add) > > ... > We have three typos here. Which makes me wonder why we're passing the new argument and then not using it?