From: Minchan Kim <minchan@kernel.org>
To: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm/zsmalloc: adjust order of functions
Date: Tue, 16 Dec 2014 14:43:58 +0900 [thread overview]
Message-ID: <20141216054357.GA17615@blaptop> (raw)
In-Reply-To: <CADAEsF99yOT0ZHD3yDxT_tOM-48=3gut+-GB6SR5BBZxZ_XY6w@mail.gmail.com>
On Tue, Dec 16, 2014 at 12:08:02PM +0800, Ganesh Mahendran wrote:
> Hello Minchan,
>
>
> 2014-12-16 8:40 GMT+08:00 Minchan Kim <minchan@kernel.org>:
> > Hello Ganesh,
> >
> > On Sat, Dec 13, 2014 at 09:43:23PM +0800, Ganesh Mahendran wrote:
> >> Currently functions in zsmalloc.c does not arranged in a readable
> >> and reasonable sequence. With the more and more functions added,
> >> we may meet below inconvenience. For example:
> >>
> >> Current functions:
> >> void zs_init()
> >> {
> >> }
> >>
> >> static void get_maxobj_per_zspage()
> >> {
> >> }
> >>
> >> Then I want to add a func_1() which is called from zs_init(), and this new added
> >> function func_1() will used get_maxobj_per_zspage() which is defined below zs_init().
> >>
> >> void func_1()
> >> {
> >> get_maxobj_per_zspage()
> >> }
> >>
> >> void zs_init()
> >> {
> >> func_1()
> >> }
> >>
> >> static void get_maxobj_per_zspage()
> >> {
> >> }
> >>
> >> This will cause compiling issue. So we must add a declaration:
> >> static void get_maxobj_per_zspage();
> >> before func_1() if we do not put get_maxobj_per_zspage() before func_1().
> >
> > Yes, I suffered from that when I made compaction but was not sure
> > it's it was obviously wrong.
> > Stupid question:
> > What's the problem if we should put function declaration on top of
> > source code?
>
> There is no problem if we do this. But if we obey to some coding
> style, then it will
> be convenient for the later developers.
> Normally I put the global or important interface function at the
> bottom of the file, and
> the static or helper functions on the top. Because usually global
> functions is the caller, and
> static functions is the callee.
>
> >
> >>
> >> In addition, puting module_[init|exit] functions at the bottom of the file
> >> conforms to our habit.
> >
> > Normally, we do but without any strong reason, I don't want to rub git-blame
> > by clean up patches.
>
> Sorry, I did not consider this when I made this patch.:)
>
> >
> > In summary, I like this patch but don't like to churn git-blame by clean-up
> > patchset without strong reason so I need something I am sure.
>
> Now, zsmalloc module is active in development. More and more changes
> will be included.
> If we do not clean up, then this file may looks messy.
>
> Thanks a lot.
Okay, you move my heart
Acked-by: Minchan Kim <minchan@kernel.org>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2014-12-16 5:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-13 13:43 Ganesh Mahendran
2014-12-16 0:40 ` Minchan Kim
2014-12-16 4:08 ` Ganesh Mahendran
2014-12-16 5:43 ` Minchan Kim [this message]
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=20141216054357.GA17615@blaptop \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=opensource.ganesh@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox