From: Arun KS <arunks@codeaurora.org>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Michal Hocko <mhocko@kernel.org>,
Arun Sudhilal <getarunks@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
Minchan Kim <minchan@kernel.org>, Michal Hocko <mhocko@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: convert totalram_pages, totalhigh_pages and managed_pages to atomic.
Date: Thu, 25 Oct 2018 11:01:41 +0530 [thread overview]
Message-ID: <9bd14fb3c0ce8ca9a33c33ce81e66037@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1810230711220.2343@hadrien>
On 2018-10-23 11:43, Julia Lawall wrote:
> On Tue, 23 Oct 2018, Michal Hocko wrote:
>
>> [Trimmed CC list + Julia - there is indeed no need to CC everybody
>> maintain a
>> file you are updating for the change like this]
>>
>> On Tue 23-10-18 10:16:51, Arun Sudhilal wrote:
>> > On Mon, Oct 22, 2018 at 11:41 PM Michal Hocko <mhocko@kernel.org> wrote:
>> > >
>> > > On Mon 22-10-18 22:53:22, Arun KS wrote:
>> > > > Remove managed_page_count_lock spinlock and instead use atomic
>> > > > variables.
>> > >
>> >
>> > Hello Michal,
>> > > I assume this has been auto-generated. If yes, it would be better to
>> > > mention the script so that people can review it and regenerate for
>> > > comparision. Such a large change is hard to review manually.
>> >
>> > Changes were made partially with script. For totalram_pages and
>> > totalhigh_pages,
>> >
>> > find dir -type f -exec sed -i
>> > 's/totalram_pages/atomic_long_read(\&totalram_pages)/g' {} \;
>> > find dir -type f -exec sed -i
>> > 's/totalhigh_pages/atomic_long_read(\&totalhigh_pages)/g' {} \;
>> >
>> > For managed_pages it was mostly manual edits after using,
>> > find mm/ -type f -exec sed -i
>> > 's/zone->managed_pages/atomic_long_read(\&zone->managed_pages)/g' {}
>> > \;
>>
>> I guess we should be able to use coccinelle for this kind of change
>> and
>> reduce the amount of manual intervention to absolute minimum.
>
> Coccinelle looks like it would be desirable, especially in case the
> word
> zone is not always used.
>
> Arun, please feel free to contact me if you want to try it and need
> help.
Hello Julia,
I was able to come up .cocci for replacing managed_pages,
@@
struct zone *z;
@@
(
z->managed_pages = ...
|
- z->managed_pages
+ atomic_long_read(&z->managed_pages)
)
@@
struct zone *z;
expression e1;
@@
- z->managed_pages = e1
+ atomic_long_set(&z->managed_pages, e1)
@@
expression e,e1;
@@
- e->managed_pages += e1
+ atomic_long_add(e1, &e->managed_pages)
@@
expression z;
@@
- z.managed_pages
+ atomic_long_read(&z.managed_pages)
But I m not able to use same method for unsigned long
variables(totalram_pages)
@@
unsigned long totalram_pages;
@@
(
totalram_pages = ...
|
-totalram_pages
+atomic_long_read(&totalram_pages)
)
This throws error,
spatch test1.cocci mm/page_alloc.c
init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: mm/page_alloc.c
previous modification:
MINUS
>>> atomic_long_read(&rule starting on line 1:totalram_pages)
According to environment 1:
rule starting on line 1.totalram_pages -> page_idx ^ (1 <<
order)
current modification:
MINUS
>>> atomic_long_read(&rule starting on line 1:totalram_pages)
According to environment 1:
rule starting on line 1.totalram_pages -> page_idx
Fatal error: exception Failure("rule starting on line 1: already tagged
token:
C code context
File "mm/internal.h", line 175, column 8, charpos = 5368
around = 'page_idx', whole content = return page_idx ^ (1 <<
order);")
Regards,
Arun
>
> julia
next prev parent reply other threads:[~2018-10-25 5:31 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-22 17:23 [PATCH] mm: convert totalram_pages, totalhigh_pages and managed_pages to atomic Arun KS
2018-10-22 17:23 ` Arun KS
2018-10-22 17:23 ` Arun KS
2018-10-22 17:23 ` Arun KS
2018-10-22 18:11 ` Michal Hocko
2018-10-23 4:15 ` Joe Perches
2018-10-23 4:15 ` Joe Perches
2018-10-23 4:15 ` Joe Perches
2018-10-23 4:15 ` Joe Perches
2018-10-23 4:15 ` Joe Perches
[not found] ` <c57bcc584b3700c483b0311881ec3ae8786f88b1.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2018-10-23 4:48 ` Arun KS
2018-10-23 4:48 ` Arun KS
2018-10-23 4:48 ` Arun KS
2018-10-23 4:48 ` Arun KS
2018-10-23 4:48 ` Arun KS
2018-10-23 4:48 ` Arun KS
2018-10-23 5:11 ` Konstantin Khlebnikov
2018-10-23 20:04 ` Kees Cook
2018-10-24 5:17 ` Arun KS
2018-10-24 6:15 ` Michal Hocko
2018-10-24 6:26 ` Joe Perches
2018-10-24 8:23 ` Michal Hocko
2018-10-24 8:39 ` Joe Perches
2018-10-25 9:21 ` Michal Hocko
2018-10-23 4:15 ` Joe Perches
2018-10-23 4:15 ` Joe Perches
2018-10-23 5:37 ` Huang, Ying
2018-11-22 1:33 ` Guo Ren
[not found] ` <1540229092-25207-1-git-send-email-arunks-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-22 18:11 ` Michal Hocko
2018-10-22 18:11 ` Michal Hocko
2018-10-22 18:11 ` Michal Hocko
2018-10-22 18:11 ` Michal Hocko
2018-10-22 18:11 ` Michal Hocko
2018-10-23 4:46 ` Arun Sudhilal
[not found] ` <20181022181122.GK18839-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2018-10-23 4:46 ` Arun Sudhilal
2018-10-23 4:46 ` Arun Sudhilal
2018-10-23 4:46 ` Arun Sudhilal
2018-10-23 4:46 ` Arun Sudhilal
2018-10-23 5:33 ` Michal Hocko
2018-10-23 5:33 ` Michal Hocko
2018-10-23 6:13 ` Julia Lawall
2018-10-23 7:11 ` Arun Sudhilal
2018-10-25 5:31 ` Arun KS [this message]
2018-10-23 4:15 ` Joe Perches
2018-10-23 5:37 ` Huang, Ying
2018-10-23 5:37 ` Huang, Ying
2018-10-23 5:37 ` Huang, Ying
2018-10-23 5:37 ` Huang, Ying
2018-10-23 5:37 ` Huang, Ying
2018-11-22 1:33 ` Guo Ren
2018-11-22 1:33 ` Guo Ren
2018-11-22 1:33 ` Guo Ren
2018-11-22 1:33 ` Guo Ren
2018-11-22 1:33 ` Guo Ren
2018-11-22 1:33 ` Guo Ren
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 1:33 ` Guo Ren
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
2018-11-22 20:01 ` Kuehling, Felix
-- strict thread matches above, loose matches on Subject: below --
2018-10-22 17:23 Arun KS
2018-10-22 17:23 Arun KS
2018-10-22 17:23 Arun KS
2018-10-22 17:23 Arun KS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bd14fb3c0ce8ca9a33c33ce81e66037@codeaurora.org \
--to=arunks@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=getarunks@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.