Re: CMA broken in next-20120926
From: Thierry Reding
Date: Tue Oct 02 2012 - 08:48:42 EST
On Mon, Oct 01, 2012 at 04:24:29PM +0200, Thierry Reding wrote:
> On Fri, Sep 28, 2012 at 01:43:32PM +0100, Mel Gorman wrote:
> > On Fri, Sep 28, 2012 at 01:39:24PM +0200, Thierry Reding wrote:
> > > On Fri, Sep 28, 2012 at 12:07:12PM +0100, Mel Gorman wrote:
> > > > On Fri, Sep 28, 2012 at 12:51:13PM +0200, Thierry Reding wrote:
> > > > > On Fri, Sep 28, 2012 at 12:38:15PM +0200, Thierry Reding wrote:
> > > > > > On Fri, Sep 28, 2012 at 12:32:07PM +0200, Thierry Reding wrote:
> > > > > > > On Fri, Sep 28, 2012 at 11:27:28AM +0100, Mel Gorman wrote:
> > > > > > > > On Fri, Sep 28, 2012 at 11:48:25AM +0300, Peter Ujfalusi wrote:
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > On 09/28/2012 11:37 AM, Mel Gorman wrote:
> > > > > > > > > >> I hope this patch fixes the bug. If this patch fixes the problem
> > > > > > > > > >> but has some problem about description or someone has better idea,
> > > > > > > > > >> feel free to modify and resend to akpm, Please.
> > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > > > A full revert is overkill. Can the following patch be tested as a
> > > > > > > > > > potential replacement please?
> > > > > > > > > >
> > > > > > > > > > ---8<---
> > > > > > > > > > mm: compaction: Iron out isolate_freepages_block() and isolate_freepages_range() -fix1
> > > > > > > > > >
> > > > > > > > > > CMA is reported to be broken in next-20120926. Minchan Kim pointed out
> > > > > > > > > > that this was due to nr_scanned != total_isolated in the case of CMA
> > > > > > > > > > because PageBuddy pages are one scan but many isolations in CMA. This
> > > > > > > > > > patch should address the problem.
> > > > > > > > > >
> > > > > > > > > > This patch is a fix for
> > > > > > > > > > mm-compaction-acquire-the-zone-lock-as-late-as-possible-fix-2.patch
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Mel Gorman <mgorman@xxxxxxx>
> > > > > > > > >
> > > > > > > > > linux-next + this patch alone also works for me.
> > > > > > > > >
> > > > > > > > > Tested-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
> > > > > > > >
> > > > > > > > Thanks Peter. I expect it also works for Thierry as I expect you were
> > > > > > > > suffering the same problem but obviously confirmation of that would be nice.
> > > > > > >
> > > > > > > I've been running a few tests and indeed this solves the obvious problem
> > > > > > > that the coherent pool cannot be created at boot (which in turn caused
> > > > > > > the ethernet adapter to fail on Tegra).
> > > > > > >
> > > > > > > However I've been working on the Tegra DRM driver, which uses CMA to
> > > > > > > allocate large chunks of framebuffer memory and these are now failing.
> > > > > > > I'll need to check if Minchan's patch solves that problem as well.
> > > > > >
> > > > > > Indeed, with Minchan's patch the DRM can allocate the framebuffer
> > > > > > without a problem. Something else must be wrong then.
> > > > >
> > > > > However, depending on the size of the allocation it also happens with
> > > > > Minchan's patch. What I see is this:
> > > > >
> > > > > [ 60.736729] alloc_contig_range test_pages_isolated(1e900, 1f0e9) failed
> > > > > [ 60.743572] alloc_contig_range test_pages_isolated(1ea00, 1f1e9) failed
> > > > > [ 60.750424] alloc_contig_range test_pages_isolated(1ea00, 1f2e9) failed
> > > > > [ 60.757239] alloc_contig_range test_pages_isolated(1ec00, 1f3e9) failed
> > > > > [ 60.764066] alloc_contig_range test_pages_isolated(1ec00, 1f4e9) failed
> > > > > [ 60.770893] alloc_contig_range test_pages_isolated(1ec00, 1f5e9) failed
> > > > > [ 60.777698] alloc_contig_range test_pages_isolated(1ec00, 1f6e9) failed
> > > > > [ 60.784526] alloc_contig_range test_pages_isolated(1f000, 1f7e9) failed
> > > > > [ 60.791148] drm tegra: Failed to alloc buffer: 8294400
> > > > >
> > > > > I'm pretty sure this did work before next-20120926.
> > > > >
> > > >
> > > > Can you double check this please?
> > > >
> > > > This is a separate bug but may be related to the same series. However, CMA should
> > > > be ignoring the "skip" hints and because it's sync compaction it should
> > > > not be exiting due to lock contention. Maybe Marek will spot it.
> > >
> > > I've written a small test module that tries to allocate growing blocks
> > > of contiguous memory and it seems like with your patch this always fails
> > > at 8 MiB.
> >
> > You earlier said it also happens with Minchan's but your statment here
> > is less clear. Does Minchan's also fail on the 8MiB boundary? Second,
> > did the test module work with next-20120926?
>
> The cmatest module that I use tries to allocate blocks from 4 KiB to 256
> MiB (in increments of powers of two). With next-20120926 this always
> fails at 8 MiB, independent of the CMA size setting (though I didn't
> test setting the CMA size to <= 8 MiB, I assumed that would make the 8
> MiB allocation fail anyway). Note that I had to apply the attached patch
> which fixes a build failure on next-20120926. I believe that Mark Brown
> posted a similar fix a few days ago. I'm also attaching a log from the
> module's test run. There's also an interesting page allocation failure
> at the very end of that log which I have not seen with next-20120925.
>
> I've run the same tests on next-20120925 with the CMA size set to 256
> MiB and only the 256 MiB allocation fails. This is normal since there
> are other modules that already allocate smaller buffers from CMA, so a
> whole 256 MiB won't be available.
>
> Vanilla 3.6-rc6 shows the same behaviour as next-20120925. I will try
> 3.6-rc7 next since that's what next-20120926 is based on. If that
> succeeds I'll try to bisect between 3.6-rc7 and next-20120926 to find
> the culprit, but that will probably take some more time as I need to
> apply at least one other commit on top to get the board to boot at all.
>
> So this really isn't all that new, but I just wanted to confirm my
> results from last week. We'll see if bisection shows up something
> interesting.
I just finished bisecting this and git reports:
3750280f8bd0ed01753a72542756a8c82ab27933 is the first bad commit
I'm attaching the complete bisection log and a diff of all the changes
applied on top of the bad commit to make it compile and run on my board.
Most of the patch is probably not important, though. There are two hunks
which have the pageblock changes I already posted an two other hunks
with the patch you posted earlier.
I hope this helps. If you want me to run any other tests, please let me
know.
Thierry
# bad: [0ea37fe67df08c854d0a39c8ff094c363eda0bb6] Add linux-next specific files for 20120926
# good: [979570e02981d4a8fc20b3cc8fd651856c98ee9d] Linux 3.6-rc7
git bisect start 'next-20120926' 'v3.6-rc7'
# good: [e5f962c00ba860a6e442a2c2b53bd256332a8a3c] Merge remote-tracking branch 'spi-mb/spi-next'
git bisect good e5f962c00ba860a6e442a2c2b53bd256332a8a3c
# good: [d2ec64078851952bbd347cd41119c49a80877c4a] Merge remote-tracking branch 'usb/usb-next'
git bisect good d2ec64078851952bbd347cd41119c49a80877c4a
# good: [71d5f924a70be51a8005a11277ee032797b644f5] Merge remote-tracking branch 'gpio-lw/for-next'
git bisect good 71d5f924a70be51a8005a11277ee032797b644f5
# good: [71d5f924a70be51a8005a11277ee032797b644f5] Merge remote-tracking branch 'gpio-lw/for-next'
git bisect good 71d5f924a70be51a8005a11277ee032797b644f5
# good: [058aa5321c0521c89b030b4d5e63d82a4973dd5f] Merge branch 'late/kirkwood' into for-next
git bisect good 058aa5321c0521c89b030b4d5e63d82a4973dd5f
# good: [c32532bac72e1261fcc9e3f5d6edf0a7f30e0f45] drivers/scsi/atp870u.c: fix bad use of udelay
git bisect good c32532bac72e1261fcc9e3f5d6edf0a7f30e0f45
# bad: [ab032478bf2d6bdd6815669a5d2e64b4d753ca43] sections: fix section conflicts in drivers/macintosh
git bisect bad ab032478bf2d6bdd6815669a5d2e64b4d753ca43
# bad: [ab032478bf2d6bdd6815669a5d2e64b4d753ca43] sections: fix section conflicts in drivers/macintosh
git bisect bad ab032478bf2d6bdd6815669a5d2e64b4d753ca43
# good: [9735f3816804ac2c4d694d5b69412275acd453ef] rbtree: remove prior augmented rbtree implementation
git bisect good 9735f3816804ac2c4d694d5b69412275acd453ef
# good: [030585452e07d6642b60ed157b637fa905926fb0] Revert "mm: have order > 0 compaction start off where it left"
git bisect good 030585452e07d6642b60ed157b637fa905926fb0
# good: [030585452e07d6642b60ed157b637fa905926fb0] Revert "mm: have order > 0 compaction start off where it left"
git bisect good 030585452e07d6642b60ed157b637fa905926fb0
# bad: [03ad92e89a2c77bbefe442abe00745192b28d8e5] mm: move all mmu notifier invocations to be done outside the PT lock
git bisect bad 03ad92e89a2c77bbefe442abe00745192b28d8e5
# bad: [ec2e5c22ffcec23861fdde919f30ddf6abe7abf9] memcg: trivial fixes for Documentation/cgroups/memory.txt
git bisect bad ec2e5c22ffcec23861fdde919f30ddf6abe7abf9
# bad: [0ef8ed15fb52b8a9fd0af217a46044e3c4eb5b30] memory-hotplug: don't replace lowmem pages with highmem
git bisect bad 0ef8ed15fb52b8a9fd0af217a46044e3c4eb5b30
# bad: [b1bda30b420402da621f0ca7d844668fb66c9c64] mm/hugetlb.c: remove duplicate inclusion of header file
git bisect bad b1bda30b420402da621f0ca7d844668fb66c9c64
# bad: [8686ddfe5d23e7b0f3e250d979b9734aac61b64a] mm: compaction: Restart compaction from near where it left off
git bisect bad 8686ddfe5d23e7b0f3e250d979b9734aac61b64a
# bad: [8686ddfe5d23e7b0f3e250d979b9734aac61b64a] mm: compaction: Restart compaction from near where it left off
git bisect bad 8686ddfe5d23e7b0f3e250d979b9734aac61b64a
# bad: [3750280f8bd0ed01753a72542756a8c82ab27933] mm: compaction: cache if a pageblock was scanned and no pages were isolated
git bisect bad 3750280f8bd0ed01753a72542756a8c82ab27933
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index c3ef1ad..e701d3d 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -7,7 +7,11 @@
compatible = "nvidia,harmony", "nvidia,tegra20";
memory {
- reg = <0x00000000 0x40000000>;
+ reg = <0x00000000 0x20000000>;
+ };
+
+ chosen {
+ bootargs = "console=ttyS0,115200n8 root=LABEL=boot:/rootfs.img ro ignore_loglevel earlyprintk";
};
pinmux {
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index e2184f6..aefd42c 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -24,7 +24,6 @@ CONFIG_EFI_PARTITION=y
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_ARCH_TEGRA=y
-CONFIG_GPIO_PCA953X=y
CONFIG_ARCH_TEGRA_2x_SOC=y
CONFIG_ARCH_TEGRA_3x_SOC=y
CONFIG_TEGRA_PCI=y
@@ -80,6 +79,14 @@ CONFIG_RFKILL_GPIO=y
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_CMA=y
+CONFIG_CMA_DEBUG=y
+CONFIG_CMA_SIZE_MBYTES=256
+CONFIG_CMA_TEST=m
+CONFIG_MTD=m
+CONFIG_MTD_CHAR=m
+CONFIG_MTD_M25P80=m
+CONFIG_MTD_NAND=m
CONFIG_PROC_DEVICETREE=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_AD525X_DPOT=y
@@ -112,71 +119,51 @@ CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C=y
# CONFIG_I2C_COMPAT is not set
-CONFIG_I2C_MUX=y
-CONFIG_I2C_MUX_PINCTRL=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_OCORES=m
CONFIG_I2C_TEGRA=y
CONFIG_SPI=y
-CONFIG_SPI_TEGRA=y
-CONFIG_GPIO_PCA953X_IRQ=y
+CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_TPS6586X=y
-CONFIG_GPIO_TPS65910=y
CONFIG_POWER_SUPPLY=y
CONFIG_BATTERY_SBS=y
CONFIG_SENSORS_LM90=y
CONFIG_MFD_TPS6586X=y
-CONFIG_MFD_TPS65910=y
-CONFIG_MFD_MAX8907=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
CONFIG_REGULATOR_GPIO=y
-CONFIG_REGULATOR_MAX8907=y
-CONFIG_REGULATOR_TPS62360=y
CONFIG_REGULATOR_TPS6586X=y
-CONFIG_REGULATOR_TPS65910=y
-CONFIG_MEDIA_SUPPORT=y
-CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_MEDIA_USB_SUPPORT=y
-CONFIG_USB_VIDEO_CLASS=m
+CONFIG_DRM=m
+CONFIG_FB=m
+CONFIG_FIRMWARE_EDID=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+# CONFIG_BACKLIGHT_GENERIC is not set
+CONFIG_BACKLIGHT_PWM=m
+CONFIG_LOGO=y
CONFIG_SOUND=y
CONFIG_SND=y
# CONFIG_SND_SUPPORT_OLD_API is not set
# CONFIG_SND_DRIVERS is not set
+# CONFIG_SND_PCI is not set
# CONFIG_SND_ARM is not set
# CONFIG_SND_SPI is not set
# CONFIG_SND_USB is not set
CONFIG_SND_SOC=y
-CONFIG_SND_SOC_TEGRA=y
-CONFIG_SND_SOC_TEGRA_WM8753=y
-CONFIG_SND_SOC_TEGRA_WM8903=y
-CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
-CONFIG_SND_SOC_TEGRA_ALC5632=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_TEGRA=y
-CONFIG_USB_ACM=y
-CONFIG_USB_WDM=y
CONFIG_USB_STORAGE=y
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=16
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_TEGRA=y
-CONFIG_NEW_LEDS=y
-CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_GPIO=y
-CONFIG_LEDS_TRIGGERS=y
-CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_RTC_CLASS=y
-CONFIG_RTC_INTF_SYSFS=y
-CONFIG_RTC_INTF_PROC=y
-CONFIG_RTC_INTF_DEV=y
-CONFIG_RTC_DRV_MAX8907=y
-CONFIG_RTC_DRV_TPS65910=y
-CONFIG_RTC_DRV_EM3027=y
CONFIG_RTC_DRV_TEGRA=y
-CONFIG_DMADEVICES=y
-CONFIG_TEGRA20_APB_DMA=y
CONFIG_STAGING=y
CONFIG_SENSORS_ISL29018=y
CONFIG_SENSORS_ISL29028=y
@@ -184,14 +171,12 @@ CONFIG_SENSORS_AK8975=y
CONFIG_MFD_NVEC=y
CONFIG_KEYBOARD_NVEC=y
CONFIG_SERIO_NVEC_PS2=y
-CONFIG_NVEC_POWER=y
-CONFIG_NVEC_PAZ00=y
CONFIG_TEGRA_IOMMU_GART=y
CONFIG_TEGRA_IOMMU_SMMU=y
CONFIG_MEMORY=y
CONFIG_IIO=y
CONFIG_PWM=y
-CONFIG_PWM_TEGRA=y
+CONFIG_PWM_TEGRA=m
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
@@ -204,14 +189,16 @@ CONFIG_EXT4_FS=y
# CONFIG_DNOTIFY is not set
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
-CONFIG_NFS_FS=y
-CONFIG_ROOT_NFS=y
+CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_XATTR=y
+CONFIG_SQUASHFS_LZO=y
+CONFIG_SQUASHFS_XZ=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_FS=y
+CONFIG_DEBUG_SECTION_MISMATCH=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_SCHEDSTATS=y
CONFIG_TIMER_STATS=y
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 08b4c52..431d387 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -280,6 +280,9 @@ config CMA_AREAS
If unsure, leave the default value "7".
+config CMA_TEST
+ tristate "CMA test module"
+
endif
endmenu
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 5aa2d70..c4b2a97 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -7,6 +7,7 @@ obj-y := core.o bus.o dd.o syscore.o \
topology.o
obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
obj-$(CONFIG_CMA) += dma-contiguous.o
+obj-$(CONFIG_CMA_TEST) += cmatest.o
obj-y += power/
obj-$(CONFIG_HAS_DMA) += dma-mapping.o
obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
diff --git a/drivers/base/cmatest.c b/drivers/base/cmatest.c
new file mode 100644
index 0000000..23d8f7f
--- /dev/null
+++ b/drivers/base/cmatest.c
@@ -0,0 +1,38 @@
+#ifdef CONFIG_CMA_DEBUG
+# ifndef DEBUG
+# define DEBUG
+# endif
+#endif
+
+#include <linux/dma-mapping.h>
+#include <linux/module.h>
+
+static int cmatest_init(void)
+{
+ unsigned int i;
+
+ for (i = 12; i <= 28; i++) {
+ dma_addr_t phys;
+ void *ptr;
+
+ ptr = dma_alloc_writecombine(NULL, 1 << i, &phys, GFP_KERNEL);
+ if (ptr) {
+ pr_debug("successfully allocated %u bytes\n", 1 << i);
+ dma_free_writecombine(NULL, 1 << i, ptr, phys);
+ } else {
+ pr_debug("failed to allocate %u bytes\n", 1 << i);
+ }
+ }
+
+ return 0;
+}
+module_init(cmatest_init);
+
+static void cmatest_exit(void)
+{
+}
+module_exit(cmatest_exit);
+
+MODULE_AUTHOR("Thierry Reding <thierry.reding@xxxxxxxxxxxxxxxxx>");
+MODULE_DESCRIPTION("Contiguous Memory Allocator test module");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 50faabe..a7a7db9 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -528,7 +528,7 @@ static inline void audit_ptrace(struct task_struct *t)
extern unsigned int audit_serial(void);
extern int auditsc_get_stamp(struct audit_context *ctx,
struct timespec *t, unsigned int *serial);
-extern int audit_set_loginuid(kuid_t loginuid);
+extern int audit_set_loginuid(kuid_t loginuid);
#define audit_get_loginuid(t) ((t)->loginuid)
#define audit_get_sessionid(t) ((t)->sessionid)
extern void audit_log_task_context(struct audit_buffer *ab);
@@ -627,97 +627,38 @@ static inline void audit_mmap_fd(int fd, int flags)
extern int audit_n_rules;
extern int audit_signals;
#else /* CONFIG_AUDITSYSCALL */
-static inline int audit_alloc(struct task_struct *task)
-{
- return 0;
-}
-static inline void audit_free(struct task_struct *task)
-{ }
-static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
- unsigned long a1, unsigned long a2,
- unsigned long a3)
-{ }
-static inline void audit_syscall_exit(void *pt_regs)
-{ }
-static inline int audit_dummy_context(void)
-{
- return 1;
-}
-static inline void audit_getname(const char *name)
-{ }
-static inline void audit_putname(const char *name)
-{ }
-static inline void __audit_inode(const char *name, const struct dentry *dentry)
-{ }
-static inline void __audit_inode_child(const struct dentry *dentry,
- const struct inode *parent)
-{ }
-static inline void audit_inode(const char *name, const struct dentry *dentry)
-{ }
-static inline void audit_inode_child(const struct dentry *dentry,
- const struct inode *parent)
-{ }
-static inline void audit_core_dumps(long signr)
-{ }
-static inline void __audit_seccomp(unsigned long syscall, long signr, int code)
-{ }
-static inline void audit_seccomp(unsigned long syscall, long signr, int code)
-{ }
-static inline int auditsc_get_stamp(struct audit_context *ctx,
- struct timespec *t, unsigned int *serial)
-{
- return 0;
-}
-static inline int audit_get_loginuid(struct task_struct *tsk)
-{
- return INVALID_UID;
-}
-static inline void audit_log_task_context(struct audit_buffer *ab)
-{ }
-static inline void audit_log_task_info(struct audit_buffer *ab,
- struct task_struct *tsk)
-{ }
-static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
-{ }
-static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
- gid_t gid, umode_t mode)
-{ }
-static inline int audit_bprm(struct linux_binprm *bprm)
-{
- return 0;
-}
-static inline void audit_socketcall(int nargs, unsigned long *args)
-{ }
-static inline void audit_fd_pair(int fd1, int fd2)
-{ }
-static inline int audit_sockaddr(int len, void *addr)
-{
- return 0;
-}
-static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
-{ }
-static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
- unsigned int msg_prio,
- const struct timespec *abs_timeout)
-{ }
-static inline void audit_mq_notify(mqd_t mqdes,
- const struct sigevent *notification)
-{ }
-static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
-{ }
-static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
- const struct cred *new,
- const struct cred *old)
-{
- return 0;
-}
-static inline void audit_log_capset(pid_t pid, const struct cred *new,
- const struct cred *old)
-{ }
-static inline void audit_mmap_fd(int fd, int flags)
-{ }
-static inline void audit_ptrace(struct task_struct *t)
-{ }
+#define audit_alloc(t) ({ 0; })
+#define audit_free(t) do { ; } while (0)
+#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
+#define audit_syscall_exit(r) do { ; } while (0)
+#define audit_dummy_context() 1
+#define audit_getname(n) do { ; } while (0)
+#define audit_putname(n) do { ; } while (0)
+#define __audit_inode(n,d) do { ; } while (0)
+#define __audit_inode_child(i,p) do { ; } while (0)
+#define audit_inode(n,d) do { (void)(d); } while (0)
+#define audit_inode_child(i,p) do { ; } while (0)
+#define audit_core_dumps(i) do { ; } while (0)
+#define audit_seccomp(i,s,c) do { ; } while (0)
+#define auditsc_get_stamp(c,t,s) (0)
+#define audit_get_loginuid(t) (INVALID_UID)
+#define audit_get_sessionid(t) (-1)
+#define audit_log_task_context(b) do { ; } while (0)
+#define audit_log_task_info(b, t) do { ; } while (0)
+#define audit_ipc_obj(i) ((void)0)
+#define audit_ipc_set_perm(q,u,g,m) ((void)0)
+#define audit_bprm(p) ({ 0; })
+#define audit_socketcall(n,a) ((void)0)
+#define audit_fd_pair(n,a) ((void)0)
+#define audit_sockaddr(len, addr) ({ 0; })
+#define audit_mq_open(o,m,a) ((void)0)
+#define audit_mq_sendrecv(d,l,p,t) ((void)0)
+#define audit_mq_notify(d,n) ((void)0)
+#define audit_mq_getsetattr(d,s) ((void)0)
+#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
+#define audit_log_capset(pid, ncr, ocr) ((void)0)
+#define audit_mmap_fd(fd, flags) ((void)0)
+#define audit_ptrace(t) ((void)0)
#define audit_n_rules 0
#define audit_signals 0
#endif /* CONFIG_AUDITSYSCALL */
@@ -741,6 +682,7 @@ extern void audit_log_n_hex(struct audit_buffer *ab,
extern void audit_log_n_string(struct audit_buffer *ab,
const char *buf,
size_t n);
+#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
const char *string,
size_t n);
@@ -757,8 +699,7 @@ extern void audit_log_lost(const char *message);
#ifdef CONFIG_SECURITY
extern void audit_log_secctx(struct audit_buffer *ab, u32 secid);
#else
-static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
-{ }
+#define audit_log_secctx(b,s) do { ; } while (0)
#endif
extern int audit_update_lsm_rules(void);
@@ -770,50 +711,22 @@ extern int audit_receive_filter(int type, int pid, int seq,
void *data, size_t datasz, kuid_t loginuid,
u32 sessionid, u32 sid);
extern int audit_enabled;
-#else /* CONFIG_AUDIT */
-static inline __printf(4, 5)
-void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
- const char *fmt, ...)
-{ }
-static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
- gfp_t gfp_mask, int type)
-{
- return NULL;
-}
-static inline __printf(2, 3)
-void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
-{ }
-static inline void audit_log_end(struct audit_buffer *ab)
-{ }
-static inline void audit_log_n_hex(struct audit_buffer *ab,
- const unsigned char *buf, size_t len)
-{ }
-static inline void audit_log_n_string(struct audit_buffer *ab,
- const char *buf, size_t n)
-{ }
-static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
- const char *string, size_t n)
-{ }
-static inline void audit_log_untrustedstring(struct audit_buffer *ab,
- const char *string)
-{ }
-static inline void audit_log_d_path(struct audit_buffer *ab,
- const char *prefix,
- const struct path *path)
-{ }
-static inline void audit_log_key(struct audit_buffer *ab, char *key)
-{ }
-static inline void audit_log_link_denied(const char *string,
- const struct path *link)
-{ }
-static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
-{ }
+#else
+#define audit_log(c,g,t,f,...) do { ; } while (0)
+#define audit_log_start(c,g,t) ({ NULL; })
+#define audit_log_vformat(b,f,a) do { ; } while (0)
+#define audit_log_format(b,f,...) do { ; } while (0)
+#define audit_log_end(b) do { ; } while (0)
+#define audit_log_n_hex(a,b,l) do { ; } while (0)
+#define audit_log_n_string(a,c,l) do { ; } while (0)
+#define audit_log_string(a,c) do { ; } while (0)
+#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
+#define audit_log_untrustedstring(a,s) do { ; } while (0)
+#define audit_log_d_path(b, p, d) do { ; } while (0)
+#define audit_log_key(b, k) do { ; } while (0)
+#define audit_log_link_denied(o, l) do { ; } while (0)
+#define audit_log_secctx(b,s) do { ; } while (0)
#define audit_enabled 0
-#endif /* CONFIG_AUDIT */
-static inline void audit_log_string(struct audit_buffer *ab, const char *buf)
-{
- audit_log_n_string(ab, buf, strlen(buf));
-}
-
+#endif
#endif
#endif
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index eed27f4..9ed5841 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -30,7 +30,7 @@ enum pageblock_bits {
PB_migrate,
PB_migrate_end = PB_migrate + 3 - 1,
/* 3 bits required for migrate types */
-#ifdef CONFIG_COMPACTION
+#if defined(CONFIG_COMPACTION) || defined(CONFIG_CMA)
PB_migrate_skip,/* If set the block is skipped by compaction */
#endif /* CONFIG_COMPACTION */
NR_PAGEBLOCK_BITS
@@ -68,7 +68,7 @@ unsigned long get_pageblock_flags_group(struct page *page,
void set_pageblock_flags_group(struct page *page, unsigned long flags,
int start_bitidx, int end_bitidx);
-#ifdef CONFIG_COMPACTION
+#if defined(CONFIG_COMPACTION) || defined(CONFIG_CMA)
#define get_pageblock_skip(page) \
get_pageblock_flags_group(page, PB_migrate_skip, \
PB_migrate_skip + 1)
diff --git a/mm/compaction.c b/mm/compaction.c
index 2769d96..3382869 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -238,6 +238,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
struct list_head *freelist,
bool strict)
{
+ unsigned long nr_strict_required = end_pfn - blockpfn;
int nr_scanned = 0, total_isolated = 0;
struct page *cursor, *valid_page = NULL;
unsigned long flags;
@@ -300,10 +301,10 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
/*
* If strict isolation is requested by CMA then check that all the
- * pages scanned were isolated. If there were any failures, 0 is
+ * pages requested were isolated. If there were any failures, 0 is
* returned and CMA will fail.
*/
- if (strict && nr_scanned != total_isolated)
+ if (strict && nr_strict_required != total_isolated)
total_isolated = 0;
if (locked)
Attachment:
pgp00000.pgp
Description: PGP signature