diff mbox

[Xenial,SRU] UBUNTU: SAUCE(no-up): If zone is so small that watermarks are the same, stop zone balance.

Message ID 1476234815-19084-1-git-send-email-gavin.guo@canonical.com
State New
Headers show

Commit Message

Gavin Guo Oct. 12, 2016, 1:13 a.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1518457

On an AWS t2.micro instance (Xeon E5-2670, 991MiB of memory).
Occasionally (about once a day), kswapd0 falls into a busy loop and
spins on 100% CPU usage indefinitely. Reject to do the zone balance
when the memory is too small.

Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
---
 mm/vmscan.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Leann Ogasawara Oct. 12, 2016, 1:20 a.m. UTC | #1
On 10/11/2016 06:13 PM, Gavin Guo wrote:
> BugLink: http://bugs.launchpad.net/bugs/1518457
> 
> On an AWS t2.micro instance (Xeon E5-2670, 991MiB of memory).
> Occasionally (about once a day), kswapd0 falls into a busy loop and
> spins on 100% CPU usage indefinitely. Reject to do the zone balance
> when the memory is too small.
> 
> Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
> Signed-off-by: Gavin Guo <gavin.guo@canonical.com>

Acked-by: Leann Ogasawara <leann.ogasawara@canonical.com>

> ---
>  mm/vmscan.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 0c114e2b01d3..21755dca16c2 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2959,6 +2959,13 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
>  static bool zone_balanced(struct zone *zone, int order,
>  			  unsigned long balance_gap, int classzone_idx)
>  {
> +	/*
> +	 * if zone is so small that watermarks are the same, don't bother trying
> +	 * to balance; kswapd would just spin continuously trying to balance it.
> +	 */
> +	if (low_wmark_pages(zone) == high_wmark_pages(zone))
> +		return true;
> +
>  	if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone) +
>  				    balance_gap, classzone_idx))
>  		return false;
>
Leann Ogasawara Oct. 12, 2016, 1:26 a.m. UTC | #2
On 10/11/2016 06:20 PM, Leann Ogasawara wrote:
> On 10/11/2016 06:13 PM, Gavin Guo wrote:
>> BugLink: http://bugs.launchpad.net/bugs/1518457
>>
>> On an AWS t2.micro instance (Xeon E5-2670, 991MiB of memory).
>> Occasionally (about once a day), kswapd0 falls into a busy loop and
>> spins on 100% CPU usage indefinitely. Reject to do the zone balance
>> when the memory is too small.
>>
>> Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
>> Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
> 
> Acked-by: Leann Ogasawara <leann.ogasawara@canonical.com>

Jay (on CC) has also tested this so add his:

Tested-by: Jay Vosburgh <jay.vosburgh@canonical.com>

>> ---
>>  mm/vmscan.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 0c114e2b01d3..21755dca16c2 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -2959,6 +2959,13 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
>>  static bool zone_balanced(struct zone *zone, int order,
>>  			  unsigned long balance_gap, int classzone_idx)
>>  {
>> +	/*
>> +	 * if zone is so small that watermarks are the same, don't bother trying
>> +	 * to balance; kswapd would just spin continuously trying to balance it.
>> +	 */
>> +	if (low_wmark_pages(zone) == high_wmark_pages(zone))
>> +		return true;
>> +
>>  	if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone) +
>>  				    balance_gap, classzone_idx))
>>  		return false;
>>
Brad Figg Oct. 12, 2016, 1:51 a.m. UTC | #3

Seth Forshee Oct. 12, 2016, 4:33 p.m. UTC | #4
On Wed, Oct 12, 2016 at 09:13:35AM +0800, Gavin Guo wrote:
> BugLink: http://bugs.launchpad.net/bugs/1518457
> 
> On an AWS t2.micro instance (Xeon E5-2670, 991MiB of memory).
> Occasionally (about once a day), kswapd0 falls into a busy loop and
> spins on 100% CPU usage indefinitely. Reject to do the zone balance
> when the memory is too small.
> 
> Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
> Signed-off-by: Gavin Guo <gavin.guo@canonical.com>

Applied to xenial and yakkety.
diff mbox

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0c114e2b01d3..21755dca16c2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2959,6 +2959,13 @@  static void age_active_anon(struct zone *zone, struct scan_control *sc)
 static bool zone_balanced(struct zone *zone, int order,
 			  unsigned long balance_gap, int classzone_idx)
 {
+	/*
+	 * if zone is so small that watermarks are the same, don't bother trying
+	 * to balance; kswapd would just spin continuously trying to balance it.
+	 */
+	if (low_wmark_pages(zone) == high_wmark_pages(zone))
+		return true;
+
 	if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone) +
 				    balance_gap, classzone_idx))
 		return false;