Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188117
b: refs/heads/master
c: 1097d7c
h: refs/heads/master
i:
  188115: 555738f
v: v3
  • Loading branch information
Linus Torvalds committed Mar 18, 2010
1 parent 4f80996 commit 2a2d849
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e06e240dcbb803433ee31bfe89a3e785a77cd3b
refs/heads/master: 1097d7cef683c30f9768007daae2e961a0686a10
15 changes: 10 additions & 5 deletions trunk/drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,16 @@ static inline int memory_fail_init(void)
* differentiation between which *physical* devices each
* section belongs to...
*/
int __weak arch_get_memory_phys_device(unsigned long start_pfn)
{
return 0;
}

static int add_memory_block(int nid, struct mem_section *section,
unsigned long state, int phys_device,
enum mem_add_context context)
unsigned long state, enum mem_add_context context)
{
struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL);
unsigned long start_pfn;
int ret = 0;

if (!mem)
Expand All @@ -443,7 +447,8 @@ static int add_memory_block(int nid, struct mem_section *section,
mem->phys_index = __section_nr(section);
mem->state = state;
mutex_init(&mem->state_mutex);
mem->phys_device = phys_device;
start_pfn = section_nr_to_pfn(mem->phys_index);
mem->phys_device = arch_get_memory_phys_device(start_pfn);

ret = register_memory(mem, section);
if (!ret)
Expand Down Expand Up @@ -515,7 +520,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,
*/
int register_new_memory(int nid, struct mem_section *section)
{
return add_memory_block(nid, section, MEM_OFFLINE, 0, HOTPLUG);
return add_memory_block(nid, section, MEM_OFFLINE, HOTPLUG);
}

int unregister_memory_section(struct mem_section *section)
Expand Down Expand Up @@ -548,7 +553,7 @@ int __init memory_dev_init(void)
if (!present_section_nr(i))
continue;
err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE,
0, BOOT);
BOOT);
if (!ret)
ret = err;
}
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/char/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ static void hpet_timer_set_irq(struct hpet_dev *devp)
else
v &= ~0xffff;

for (irq = find_first_bit(&v, HPET_MAX_IRQ); irq < HPET_MAX_IRQ;
irq = find_next_bit(&v, HPET_MAX_IRQ, 1 + irq)) {

for_each_set_bit(irq, &v, HPET_MAX_IRQ) {
if (irq >= nr_irqs) {
irq = HPET_MAX_IRQ;
break;
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/s390/char/sclp_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,13 @@ int sclp_chp_deconfigure(struct chp_id chpid)
return do_chp_configure(SCLP_CMDW_DECONFIGURE_CHPATH | chpid.id << 8);
}

int arch_get_memory_phys_device(unsigned long start_pfn)
{
if (!rzm)
return 0;
return PFN_PHYS(start_pfn) / rzm;
}

struct chp_info_sccb {
struct sccb_header header;
u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/jffs2/readinode.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ static void jffs2_free_tmp_dnode_info_list(struct rb_root *list)
else BUG();
}
}
list->rb_node = NULL;
*list = RB_ROOT;
}

static void jffs2_free_full_dirent_list(struct jffs2_full_dirent *fd)
Expand Down
25 changes: 13 additions & 12 deletions trunk/fs/ntfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/vfs.h>
#include <linux/moduleparam.h>
#include <linux/smp_lock.h>
#include <linux/bitmap.h>

#include "sysctl.h"
#include "logfile.h"
Expand Down Expand Up @@ -2458,7 +2459,6 @@ static void ntfs_put_super(struct super_block *sb)
static s64 get_nr_free_clusters(ntfs_volume *vol)
{
s64 nr_free = vol->nr_clusters;
u32 *kaddr;
struct address_space *mapping = vol->lcnbmp_ino->i_mapping;
struct page *page;
pgoff_t index, max_index;
Expand All @@ -2477,7 +2477,8 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
ntfs_debug("Reading $Bitmap, max_index = 0x%lx, max_size = 0x%lx.",
max_index, PAGE_CACHE_SIZE / 4);
for (index = 0; index < max_index; index++) {
unsigned int i;
unsigned long *kaddr;

/*
* Read the page from page cache, getting it from backing store
* if necessary, and increment the use count.
Expand All @@ -2490,16 +2491,16 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
nr_free -= PAGE_CACHE_SIZE * 8;
continue;
}
kaddr = (u32*)kmap_atomic(page, KM_USER0);
kaddr = kmap_atomic(page, KM_USER0);
/*
* For each 4 bytes, subtract the number of set bits. If this
* Subtract the number of set bits. If this
* is the last page and it is partial we don't really care as
* it just means we do a little extra work but it won't affect
* the result as all out of range bytes are set to zero by
* ntfs_readpage().
*/
for (i = 0; i < PAGE_CACHE_SIZE / 4; i++)
nr_free -= (s64)hweight32(kaddr[i]);
nr_free -= bitmap_weight(kaddr,
PAGE_CACHE_SIZE * BITS_PER_BYTE);
kunmap_atomic(kaddr, KM_USER0);
page_cache_release(page);
}
Expand Down Expand Up @@ -2538,7 +2539,6 @@ static s64 get_nr_free_clusters(ntfs_volume *vol)
static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
s64 nr_free, const pgoff_t max_index)
{
u32 *kaddr;
struct address_space *mapping = vol->mftbmp_ino->i_mapping;
struct page *page;
pgoff_t index;
Expand All @@ -2548,7 +2548,8 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
ntfs_debug("Reading $MFT/$BITMAP, max_index = 0x%lx, max_size = "
"0x%lx.", max_index, PAGE_CACHE_SIZE / 4);
for (index = 0; index < max_index; index++) {
unsigned int i;
unsigned long *kaddr;

/*
* Read the page from page cache, getting it from backing store
* if necessary, and increment the use count.
Expand All @@ -2561,16 +2562,16 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol,
nr_free -= PAGE_CACHE_SIZE * 8;
continue;
}
kaddr = (u32*)kmap_atomic(page, KM_USER0);
kaddr = kmap_atomic(page, KM_USER0);
/*
* For each 4 bytes, subtract the number of set bits. If this
* Subtract the number of set bits. If this
* is the last page and it is partial we don't really care as
* it just means we do a little extra work but it won't affect
* the result as all out of range bytes are set to zero by
* ntfs_readpage().
*/
for (i = 0; i < PAGE_CACHE_SIZE / 4; i++)
nr_free -= (s64)hweight32(kaddr[i]);
nr_free -= bitmap_weight(kaddr,
PAGE_CACHE_SIZE * BITS_PER_BYTE);
kunmap_atomic(kaddr, KM_USER0);
page_cache_release(page);
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct memory_block {
struct sys_device sysdev;
};

int arch_get_memory_phys_device(unsigned long start_pfn);

/* These states are exposed to userspace as text strings in sysfs */
#define MEM_ONLINE (1<<0) /* exposed to userspace */
#define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */
Expand Down
20 changes: 16 additions & 4 deletions trunk/mm/page_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ static DEFINE_MUTEX(swap_cgroup_mutex);
struct swap_cgroup_ctrl {
struct page **map;
unsigned long length;
spinlock_t lock;
};

struct swap_cgroup_ctrl swap_cgroup_ctrl[MAX_SWAPFILES];
Expand Down Expand Up @@ -353,16 +354,22 @@ unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
struct swap_cgroup_ctrl *ctrl;
struct page *mappage;
struct swap_cgroup *sc;
unsigned long flags;
unsigned short retval;

ctrl = &swap_cgroup_ctrl[type];

mappage = ctrl->map[idx];
sc = page_address(mappage);
sc += pos;
if (cmpxchg(&sc->id, old, new) == old)
return old;
spin_lock_irqsave(&ctrl->lock, flags);
retval = sc->id;
if (retval == old)
sc->id = new;
else
return 0;
retval = 0;
spin_unlock_irqrestore(&ctrl->lock, flags);
return retval;
}

/**
Expand All @@ -383,13 +390,17 @@ unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
struct page *mappage;
struct swap_cgroup *sc;
unsigned short old;
unsigned long flags;

ctrl = &swap_cgroup_ctrl[type];

mappage = ctrl->map[idx];
sc = page_address(mappage);
sc += pos;
old = xchg(&sc->id, id);
spin_lock_irqsave(&ctrl->lock, flags);
old = sc->id;
sc->id = id;
spin_unlock_irqrestore(&ctrl->lock, flags);

return old;
}
Expand Down Expand Up @@ -441,6 +452,7 @@ int swap_cgroup_swapon(int type, unsigned long max_pages)
mutex_lock(&swap_cgroup_mutex);
ctrl->length = length;
ctrl->map = array;
spin_lock_init(&ctrl->lock);
if (swap_cgroup_prepare(type)) {
/* memory shortage */
ctrl->map = NULL;
Expand Down

0 comments on commit 2a2d849

Please sign in to comment.