From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages() Date: Thu, 3 Sep 2020 18:12:52 +0200 Message-ID: <20200903161252.GA24841@lst.de> References: <20200901221646.26491-1-nicoleotsuka@gmail.com> <20200901221646.26491-2-nicoleotsuka@gmail.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-parisc-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andy Shevchenko Cc: Nicolin Chen , Christoph Hellwig , Stephen Rothwell , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , Linux Kernel Mailing List , rth@twiddle.net, ink@jurassic.park.msu.ru, Matt Turner , linux-alpha@vger.kernel.org, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, schnelle@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ? dma_get_seg_boundary(dev) : U32_MAX; > > return (boundary >> page_shift) + 1; > > ? I don't really see what that would buy us. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Date: Thu, 03 Sep 2020 16:12:52 +0000 Subject: Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages() Message-Id: <20200903161252.GA24841@lst.de> List-Id: References: <20200901221646.26491-1-nicoleotsuka@gmail.com> <20200901221646.26491-2-nicoleotsuka@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andy Shevchenko Cc: Nicolin Chen , Christoph Hellwig , Stephen Rothwell , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , Linux Kernel Mailing List , rth@twiddle.net, ink@jurassic.park.msu.ru, Matt Turner , linux-alpha@vger.kernel.org, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, schnelle@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , James Bottomley , Helge Deller , linux-parisc@vger.kernel.org On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ? dma_get_seg_boundary(dev) : U32_MAX; > > return (boundary >> page_shift) + 1; > > ? I don't really see what that would buy us. 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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 45B11C433E9 for ; Thu, 3 Sep 2020 16:12:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 207F520C09 for ; Thu, 3 Sep 2020 16:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728501AbgICQM6 (ORCPT ); Thu, 3 Sep 2020 12:12:58 -0400 Received: from verein.lst.de ([213.95.11.211]:38543 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728294AbgICQM6 (ORCPT ); Thu, 3 Sep 2020 12:12:58 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 0749867357; Thu, 3 Sep 2020 18:12:53 +0200 (CEST) Date: Thu, 3 Sep 2020 18:12:52 +0200 From: Christoph Hellwig To: Andy Shevchenko Cc: Nicolin Chen , Christoph Hellwig , Stephen Rothwell , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , Linux Kernel Mailing List , rth@twiddle.net, ink@jurassic.park.msu.ru, Matt Turner , linux-alpha@vger.kernel.org, Tony Luck , Fenghua Yu , linux-ia64@vger.kernel.org, schnelle@linux.ibm.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , James Bottomley , Helge Deller , linux-parisc@vger.kernel.org Subject: Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages() Message-ID: <20200903161252.GA24841@lst.de> References: <20200901221646.26491-1-nicoleotsuka@gmail.com> <20200901221646.26491-2-nicoleotsuka@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ? dma_get_seg_boundary(dev) : U32_MAX; > > return (boundary >> page_shift) + 1; > > ? I don't really see what that would buy us. 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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 5FBE7C433E9 for ; Thu, 3 Sep 2020 16:58:17 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 C7A90206A5 for ; Thu, 3 Sep 2020 16:58:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7A90206A5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4Bj6Sk5ykVzDrC8 for ; Fri, 4 Sep 2020 02:58:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lst.de (client-ip=213.95.11.211; helo=verein.lst.de; envelope-from=hch@lst.de; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Bj5SW2qykzDqvT for ; Fri, 4 Sep 2020 02:12:59 +1000 (AEST) Received: by verein.lst.de (Postfix, from userid 2407) id 0749867357; Thu, 3 Sep 2020 18:12:53 +0200 (CEST) Date: Thu, 3 Sep 2020 18:12:52 +0200 From: Christoph Hellwig To: Andy Shevchenko Subject: Re: [PATCH 1/2] dma-mapping: introduce dma_get_seg_boundary_nr_pages() Message-ID: <20200903161252.GA24841@lst.de> References: <20200901221646.26491-1-nicoleotsuka@gmail.com> <20200901221646.26491-2-nicoleotsuka@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, James Bottomley , Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, Christoph Hellwig , Stephen Rothwell , Helge Deller , "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , Christian Borntraeger , Ingo Molnar , Matt Turner , Fenghua Yu , Vasily Gorbik , schnelle@linux.ibm.com, hca@linux.ibm.com, Nicolin Chen , ink@jurassic.park.msu.ru, Thomas Gleixner , gerald.schaefer@linux.ibm.com, rth@twiddle.net, Tony Luck , linux-parisc@vger.kernel.org, linux-s390@vger.kernel.org, Linux Kernel Mailing List , linux-alpha@vger.kernel.org, Borislav Petkov , "open list:LINUX FOR POWERPC PA SEMI PWRFICIENT" , "David S. Miller" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Sep 03, 2020 at 01:57:39PM +0300, Andy Shevchenko wrote: > > +{ > > + if (!dev) > > + return (U32_MAX >> page_shift) + 1; > > + return (dma_get_seg_boundary(dev) >> page_shift) + 1; > > Can it be better to do something like > unsigned long boundary = dev ? dma_get_seg_boundary(dev) : U32_MAX; > > return (boundary >> page_shift) + 1; > > ? I don't really see what that would buy us.