From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbcFJEwE (ORCPT ); Fri, 10 Jun 2016 00:52:04 -0400 Received: from out1134-203.mail.aliyun.com ([42.120.134.203]:10450 "EHLO out1134-203.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756AbcFJEwC (ORCPT ); Fri, 10 Jun 2016 00:52:02 -0400 X-Greylist: delayed 317 seconds by postgrey-1.27 at vger.kernel.org; Fri, 10 Jun 2016 00:52:01 EDT X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07450579|-1;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03294;MF=chengang@emindsoft.com.cn;NM=1;PH=DS;RN=13;RT=12;SR=0;TI=SMTPD_----4ucTVWl_1465533973; From: chengang@emindsoft.com.cn To: akpm@linux-foundation.org, trivial@kernel.org Cc: vdavydov@virtuozzo.com, mhocko@suse.cz, riel@redhat.com, rientjes@google.com, hughd@google.com, nzimmer@sgi.com, baiyaowei@cmss.chinamobile.com, linux-kernel@vger.kernel.org, Chen Gang , Chen Gang Subject: [PATCH trivial] include/linux/mempolicy.h: Clean up code Date: Fri, 10 Jun 2016 12:46:10 +0800 Message-Id: <1465533970-24574-1-git-send-email-chengang@emindsoft.com.cn> X-Mailer: git-send-email 1.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Gang Use one return statement instead of multiple statements, since the new return statement is still simple enough. Let the second line function parameter almost align with the first line function parameter. Signed-off-by: Chen Gang --- include/linux/mempolicy.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 4429d25..3d7e9c0 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -85,9 +85,7 @@ static inline void mpol_cond_put(struct mempolicy *pol) extern struct mempolicy *__mpol_dup(struct mempolicy *pol); static inline struct mempolicy *mpol_dup(struct mempolicy *pol) { - if (pol) - pol = __mpol_dup(pol); - return pol; + return pol ? __mpol_dup(pol) : NULL; } #define vma_policy(vma) ((vma)->vm_policy) @@ -101,9 +99,7 @@ static inline void mpol_get(struct mempolicy *pol) extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b); static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b) { - if (a == b) - return true; - return __mpol_equal(a, b); + return (a == b) || __mpol_equal(a, b); } /* @@ -136,7 +132,7 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp, struct mempolicy *get_task_policy(struct task_struct *p); struct mempolicy *__get_vma_policy(struct vm_area_struct *vma, - unsigned long addr); + unsigned long addr); bool vma_policy_mof(struct vm_area_struct *vma); extern void numa_default_policy(void); @@ -150,7 +146,7 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, struct mempolicy **mpol, nodemask_t **nodemask); extern bool init_nodemask_of_mempolicy(nodemask_t *mask); extern bool mempolicy_nodemask_intersects(struct task_struct *tsk, - const nodemask_t *mask); + const nodemask_t *mask); extern unsigned int mempolicy_slab_node(void); extern enum zone_type policy_zone; @@ -187,11 +183,9 @@ static inline bool vma_migratable(struct vm_area_struct *vma) * do so then migration (at least from node to node) is not * possible. */ - if (vma->vm_file && + return !(vma->vm_file && gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping)) - < policy_zone) - return false; - return true; + < policy_zone); } extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long); -- 1.9.3