Bug 145791

Summary: [SOUP] Network Cache: Give more priority to reads over writes in IO WorkQueue
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, svillar, zan
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch svillar: review+

Description Carlos Garcia Campos 2015-06-09 01:04:43 PDT
We could keep the default priority for reads and use idle priority for writes.
Comment 1 Carlos Garcia Campos 2015-06-09 01:09:05 PDT
Created attachment 254555 [details]
Patch
Comment 2 WebKit Commit Bot 2015-06-09 01:11:48 PDT
Attachment 254555 [details] did not pass style-queue:


ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:72:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Sergio Villar Senin 2015-06-09 01:15:27 PDT
Comment on attachment 254555 [details]
Patch

Seems like a good idea, hope it doesn't lead to starvation
Comment 4 Carlos Garcia Campos 2015-06-09 01:18:33 PDT
(In reply to comment #3)
> Comment on attachment 254555 [details]
> Patch
> 
> Seems like a good idea, hope it doesn't lead to starvation

Thanks. Well, this main loop only runs disk cache read/write tasks, so at some point it will finish reading resources from cache and writes will happen, I guess.
Comment 5 Zan Dobersek 2015-06-09 02:17:00 PDT
Comment on attachment 254555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254555&action=review

> Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:268
>      runTaskInQueue([channel, offset, data, completionHandler] {
>          channel->write(offset, data, completionHandler);
> -    }, queue);
> +    }, queue, G_PRIORITY_DEFAULT_IDLE);

This is never called with a non-null WorkQueue, meaning it's always scheduled on the main context. The point being, is the WorkQueue priority scheduling necessary?
Comment 6 Carlos Garcia Campos 2015-06-09 02:36:27 PDT
(In reply to comment #5)
> Comment on attachment 254555 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=254555&action=review
> 
> > Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:268
> >      runTaskInQueue([channel, offset, data, completionHandler] {
> >          channel->write(offset, data, completionHandler);
> > -    }, queue);
> > +    }, queue, G_PRIORITY_DEFAULT_IDLE);
> 
> This is never called with a non-null WorkQueue, meaning it's always
> scheduled on the main context. The point being, is the WorkQueue priority
> scheduling necessary?

It's rather the opposite, since it always receives a work queue, it's never scheduled in the main context, but in the work queue main context, and we still want IOChannel::read() to happen before IOChannel::write().
Comment 7 Carlos Garcia Campos 2015-06-09 10:12:29 PDT
Committed r185366: <http://trac.webkit.org/changeset/185366>