Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-15 Thread Kouhei Kaigai
> > On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > > > Hello, > > > > > > I recently got a trouble on development of my extension that > > > utilizes the shared buffer when it released each buffer page. > > > > > > This extension transfers contents of the shared buffers to GPU > > > device using DM

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-04 Thread Kouhei Kaigai
> Heikki Linnakangas writes: > > On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > >> What is the best way to solve the problem? > > > How about creating a separate ResourceOwner for these buffer pins, and > > doing a wholesale ResourceOwnerRelease() on it when you're done? > > That's a thought. A

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-04 Thread Kouhei Kaigai
> On 03/10/2014 05:53, Kouhei Kaigai wrote: > > Yep, that's my pain. Even though usual query does not take many > > buffers pinned, my use case needs to fetch megabytes scale data at > > once because of performance reason; page-by-page synchronous scan makes > GPU being idle. > Doesn't your GPU hav

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread Tom Lane
Heikki Linnakangas writes: > On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: >> What is the best way to solve the problem? > How about creating a separate ResourceOwner for these buffer pins, and > doing a wholesale ResourceOwnerRelease() on it when you're done? That's a thought. Another point is

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread james
On 03/10/2014 05:53, Kouhei Kaigai wrote: > Yep, that's my pain. Even though usual query does not take many buffers > pinned, > my use case needs to fetch megabytes scale data at once because of performance > reason; page-by-page synchronous scan makes GPU being idle. Doesn't your GPU have an asyn

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread Kouhei Kaigai
> On 2014-10-03 10:35:42 +0300, Heikki Linnakangas wrote: > > On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > > > Hello, > > > > > > I recently got a trouble on development of my extension that > > > utilizes the shared buffer when it released each buffer page. > > > > > > This extension transfers c

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread Kouhei Kaigai
> On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > > Hello, > > > > I recently got a trouble on development of my extension that utilizes > > the shared buffer when it released each buffer page. > > > > This extension transfers contents of the shared buffers to GPU device > > using DMA feature, then

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread Andres Freund
On 2014-10-03 10:35:42 +0300, Heikki Linnakangas wrote: > On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > > Hello, > > > > I recently got a trouble on development of my extension that utilizes > > the shared buffer when it released each buffer page. > > > > This extension transfers contents of the

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-03 Thread Heikki Linnakangas
On 10/03/2014 07:08 AM, Kouhei Kaigai wrote: > Hello, > > I recently got a trouble on development of my extension that utilizes > the shared buffer when it released each buffer page. > > This extension transfers contents of the shared buffers to GPU device > using DMA feature, then kicks a device

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-02 Thread Kouhei Kaigai
> Kouhei Kaigai writes: > > Idea-1) Put ResourceOwnerForgetBuffer() O(1) logic, instead of O(N^2). > > The source of problem come from data structure in ResourceOwnerData, > > so a straightforward way is to apply O(1) logic based on hashing, > > instead of the linear search. > > I will bet that t

Re: [HACKERS] How to make ResourceOwnerForgetBuffer() O(1), instead of O(N^2) scale

2014-10-02 Thread Tom Lane
Kouhei Kaigai writes: > Idea-1) Put ResourceOwnerForgetBuffer() O(1) logic, instead of O(N^2). > The source of problem come from data structure in ResourceOwnerData, > so a straightforward way is to apply O(1) logic based on hashing, > instead of the linear search. I will bet that this is a dead