Merge remote-tracking branch 'upstream_CHRONO/kk44' into 3.0.101-EXP

Change-Id: Ic31eae63bba0f99bd17796817e65bd3b1ffad8d2
writeback: fix race that cause writeback hung

There is a race between mark inode dirty and writeback thread, see the
following scenario.  In this case, writeback thread will not run though
there is dirty_io.

__mark_inode_dirty()                                          bdi_writeback_workfn()
	...                                                       	...
	spin_lock(&inode->i_lock);
	...
	if (bdi_cap_writeback_dirty(bdi)) {
	    <<< assume wb has dirty_io, so wakeup_bdi is false.
	    <<< the following inode_dirty also have wakeup_bdi false.
	    if (!wb_has_dirty_io(&bdi->wb))
		    wakeup_bdi = true;
	}
	spin_unlock(&inode->i_lock);
	                                                            <<< assume last dirty_io is removed here.
	                                                            pages_written = wb_do_writeback(wb);
	                                                            ...
	                                                            <<< work_list empty and wb has no dirty_io,
	                                                            <<< delayed_work will not be queued.
	                                                            if (!list_empty(&bdi->work_list) ||
	                                                                (wb_has_dirty_io(wb) && dirty_writeback_interval))
	                                                                queue_delayed_work(bdi_wq, &wb->dwork,
	                                                                    msecs_to_jiffies(dirty_writeback_interval * 10));
	spin_lock(&bdi->wb.list_lock);
	inode->dirtied_when = jiffies;
	<<< new dirty_io is added.
	list_move(&inode->i_wb_list, &bdi->wb.b_dirty);
	spin_unlock(&bdi->wb.list_lock);

	<<< though there is dirty_io, but wakeup_bdi is false,
	<<< so writeback thread will not be waked up and
	<<< the new dirty_io will not be flushed.
	if (wakeup_bdi)
	    bdi_wakeup_thread_delayed(bdi);

Writeback will run until there is a new flush work queued.  This may cause
a lot of dirty pages stay in memory for a long time.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Change-Id: I4853ae2173d1a529a6574b1b46f584b919647e99
[zwliew: adapt to 3.0]
Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>

Conflicts:
	fs/fs-writeback.c

	modified:   fs/fs-writeback.c
Use ZCache instead ZRam for i9070/i9070P

Change-Id: I207e17705f17f15c41964b2adbc68129141ecab3
fs-writebac: fix compiling error caused by spin_lock(&inode_wb_list_lock) function

Change-Id: I4b296302c923a04248a2b7b94e2f505090dd7ed2
defconfig i9070 : don't build some modules

Change-Id: Iac1b73a42b25221764bb0cb9d576749fc8cf658a
Revert "cpufreq: re-add ZenX"

This reverts commit 63134786add5d8d22ebd0cb5cfd1138bd505aabd.

Conflicts:
	arch/arm/configs/codina_defconfig
	arch/arm/configs/codina_stock_defconfig
	drivers/cpufreq/cpufreq_zenx.c
	fs/exfat/exfat_super.c

	modified:   Makefile
	modified:   arch/arm/configs/codina_defconfig
	modified:   arch/arm/configs/codina_stock_defconfig
	modified:   drivers/cpufreq/Kconfig
	modified:   drivers/cpufreq/Makefile
	deleted:    drivers/cpufreq/cpufreq_zenx.c
	modified:   fs/exfat/exfat_super.c
	modified:   include/linux/cpufreq.h

Change-Id: I7616b7dd89f201a62db24ca10266f6a31187549a
Revert "cpufreq: add ondemand two-phase scheduling"

This reverts commit f7d871eddcdaf3691dad77ca8d5eecbe62cb16f1.

Conflicts:
	drivers/cpufreq/Kconfig
	drivers/cpufreq/cpufreq_ondemand.c

	modified:   drivers/cpufreq/Kconfig
	modified:   drivers/cpufreq/cpufreq_ondemand.c

Change-Id: Ic564ecc963d0f38e1740be7052ede15dba91e047
mali_platform.c Fix merge error,<<<<HEAD in code, caused by me

Change-Id: I71fc457bd2fdb21e76f13738bbd5c2454ac0bce8