lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 2 Sep 2014 14:42:14 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Johannes Weiner <hannes@...xchg.org>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...e.de>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [patch] mm: clean up zone flags

On Tue, 2 Sep 2014, Johannes Weiner wrote:

> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 318df7051850..48bf12ef6620 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -521,13 +521,13 @@ struct zone {
>  	atomic_long_t		vm_stat[NR_VM_ZONE_STAT_ITEMS];
>  } ____cacheline_internodealigned_in_smp;
>  
> -typedef enum {
> +enum zone_flags {
>  	ZONE_RECLAIM_LOCKED,		/* prevents concurrent reclaim */
>  	ZONE_OOM_LOCKED,		/* zone is in OOM killer zonelist */
>  	ZONE_CONGESTED,			/* zone has many dirty pages backed by
>  					 * a congested BDI
>  					 */
> -	ZONE_TAIL_LRU_DIRTY,		/* reclaim scanning has recently found
> +	ZONE_DIRTY,			/* reclaim scanning has recently found
>  					 * many dirty file pages at the tail
>  					 * of the LRU.
>  					 */
> @@ -535,52 +535,7 @@ typedef enum {
>  					 * many pages under writeback
>  					 */
>  	ZONE_FAIR_DEPLETED,		/* fair zone policy batch depleted */
> -} zone_flags_t;
> -
> -static inline void zone_set_flag(struct zone *zone, zone_flags_t flag)
> -{
> -	set_bit(flag, &zone->flags);
> -}
> -
> -static inline int zone_test_and_set_flag(struct zone *zone, zone_flags_t flag)
> -{
> -	return test_and_set_bit(flag, &zone->flags);
> -}
> -
> -static inline void zone_clear_flag(struct zone *zone, zone_flags_t flag)
> -{
> -	clear_bit(flag, &zone->flags);
> -}
> -
> -static inline int zone_is_reclaim_congested(const struct zone *zone)
> -{
> -	return test_bit(ZONE_CONGESTED, &zone->flags);
> -}
> -
> -static inline int zone_is_reclaim_dirty(const struct zone *zone)
> -{
> -	return test_bit(ZONE_TAIL_LRU_DIRTY, &zone->flags);
> -}
> -
> -static inline int zone_is_reclaim_writeback(const struct zone *zone)
> -{
> -	return test_bit(ZONE_WRITEBACK, &zone->flags);
> -}
> -
> -static inline int zone_is_reclaim_locked(const struct zone *zone)
> -{
> -	return test_bit(ZONE_RECLAIM_LOCKED, &zone->flags);
> -}
> -
> -static inline int zone_is_fair_depleted(const struct zone *zone)
> -{
> -	return test_bit(ZONE_FAIR_DEPLETED, &zone->flags);
> -}
> -
> -static inline int zone_is_oom_locked(const struct zone *zone)
> -{
> -	return test_bit(ZONE_OOM_LOCKED, &zone->flags);
> -}
> +};
>  
>  static inline unsigned long zone_end_pfn(const struct zone *zone)
>  {
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index 1706cbbdf5f0..d7a9051a6db5 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -631,7 +631,7 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
>  	 * of sleeping on the congestion queue
>  	 */
>  	if (atomic_read(&nr_bdi_congested[sync]) == 0 ||
> -			!zone_is_reclaim_congested(zone)) {
> +	    test_bit(ZONE_CONGESTED, &zone->flags)) {
>  		cond_resched();
>  
>  		/* In case we scheduled, work out time remaining */

That's not equivalent.

[snip]

> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2836b5373b2e..590a92bec6a4 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -920,7 +920,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
>  			/* Case 1 above */
>  			if (current_is_kswapd() &&
>  			    PageReclaim(page) &&
> -			    zone_is_reclaim_writeback(zone)) {
> +			    test_bit(ZONE_WRITEBACK, &zone->flags)) {
>  				nr_immediate++;
>  				goto keep_locked;
>  
> @@ -1002,7 +1002,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
>  			 */
>  			if (page_is_file_cache(page) &&
>  					(!current_is_kswapd() ||
> -					 !zone_is_reclaim_dirty(zone))) {
> +					 test_bit(ZONE_DIRTY, &zone->flags))) {
>  				/*
>  				 * Immediately reclaim when written back.
>  				 * Similar in principal to deactivate_page()

Nor is this.

After fixed, for the oom killer bits:

	Acked-by: David Rientjes <rientjes@...gle.com>

since this un-obscurification is most welcome.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ