lkml.org 
[lkml]   [2017]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 5/7] mm, vmscan: extract shrink_page_list reclaim counters into a struct
    From
    Date
    On 01/04/2017 11:19 AM, Michal Hocko wrote:
    > From: Michal Hocko <mhocko@suse.com>
    >
    > shrink_page_list returns quite some counters back to its caller. Extract
    > the existing 5 into struct reclaim_stat because this makes the code
    > easier to follow and also allows further counters to be returned.
    >
    > While we are at it, make all of them unsigned rather than unsigned long
    > as we do not really need full 64b for them (we never scan more than
    > SWAP_CLUSTER_MAX pages at once). This should reduce some stack space.
    >
    > This patch shouldn't introduce any functional change.

    [...]

    > @@ -1266,11 +1270,13 @@ static unsigned long shrink_page_list(struct list_head *page_list,
    > list_splice(&ret_pages, page_list);
    > count_vm_events(PGACTIVATE, pgactivate);
    >
    > - *ret_nr_dirty += nr_dirty;
    > - *ret_nr_congested += nr_congested;
    > - *ret_nr_unqueued_dirty += nr_unqueued_dirty;
    > - *ret_nr_writeback += nr_writeback;
    > - *ret_nr_immediate += nr_immediate;
    > + if (stat) {
    > + stat->nr_dirty = nr_dirty;
    > + stat->nr_congested = nr_congested;
    > + stat->nr_unqueued_dirty = nr_unqueued_dirty;
    > + stat->nr_writeback = nr_writeback;
    > + stat->nr_immediate = nr_immediate;
    > + }

    This change of '+=' to '=' raised my eybrows, but it seems both callers
    don't care so this is indeed no functional change and potentially faster.


    \
     
     \ /
      Last update: 2017-01-04 15:55    [W:2.653 / U:0.440 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site