Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559601

Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential scatterlist entry overflow

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential scatterlist entry overflow
Date 2017-01-16 11:20 +0100
Message-ID <t0cyn-7r8-39@gated-at.bofh.it> (permalink)
References (1 earlier) <sYpJo-6v8-15@gated-at.bofh.it> <sYB7P-5mx-15@gated-at.bofh.it> <sZ5yW-72H-23@gated-at.bofh.it> <sZiwa-6rO-13@gated-at.bofh.it> <t0coG-7kg-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jan 16, 2017 at 12:05 PM, Tvrtko Ursulin
<tvrtko.ursulin@linux.intel.com> wrote:
>>>>> -       for (i = 1; i < n_pages; ++i)
>>>>> +       for (i = 1; i < n_pages; ++i) {

>>>> // Are compilers so stupid doing calculation per iteration in
>>>> for-conditional?
>>>> // for (i = 0; i + 1 < n_pages; i++) ?

>>> I didn't get what you meant here?

>> Why do we start from 1? I see here two micro (?) optimizations:
>> 1) starting from 1 on believe that compiler dumb enough to every time
>> do a calculation in condition;

> The existing code starts from 1 because the pfn condition looks up page i -
> 1. I don't feel there is a need to change that as well.

>> 2) ++i instead of i++, but this is just matter of style, it's not a c++.

> Note that I haven't changed the existing code in this respect. I am happy to
> change it though.

Yes, this is another story. Just a side note to existing code, indeed.

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] lib/scatterlist: Fix offset type in sg_alloc_table_from_pages Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 10:10 +0100
  [PATCH 3/4] lib/scatterlist: Introduce and export __sg_alloc_table_from_pages Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 10:10 +0100
  [PATCH 4/4] drm/i915: Use __sg_alloc_table_from_pages for userptr allocations Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 10:10 +0100
    [PATCH v6] drm/i915: Use __sg_alloc_table_from_pages for userptr allocations Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 13:10 +0100
  [PATCH 2/4] lib/scatterlist: Avoid potential scatterlist entry overflow Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 10:10 +0100
    [PATCH v4] lib/scatterlist: Avoid potential scatterlist entry overflow Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 13:00 +0100
      Re: [PATCH v4] lib/scatterlist: Avoid potential scatterlist entry overflow Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-12 01:10 +0100
        Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential  scatterlist entry overflow Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> - 2017-01-13 09:40 +0100
          Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential  scatterlist entry overflow Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-13 23:30 +0100
            Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential  scatterlist entry overflow Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> - 2017-01-16 11:10 +0100
              Re: [Intel-gfx] [PATCH v4] lib/scatterlist: Avoid potential  scatterlist entry overflow Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-16 11:20 +0100
  [PATCH v5] lib/scatterlist: Introduce and export __sg_alloc_table_from_pages Tvrtko Ursulin <tursulin@ursulin.net> - 2017-01-11 13:00 +0100

csiph-web